acecalisto3 commited on
Commit
f697caa
·
verified ·
1 Parent(s): f89dbaa

Update appaaa.py

Browse files
Files changed (1) hide show
  1. appaaa.py +55 -35
appaaa.py CHANGED
@@ -327,45 +327,65 @@ async def respond(
327
  yield "I'm not sure what you mean. Try using `/help` for a list of available commands."
328
 
329
  def create_gradio_interface():
330
- def process_command(
331
- command: str,
332
- system_message: str,
333
- max_tokens: int,
334
- temperature: float,
335
- top_p: float,
336
- github_token: str,
337
- github_username: str,
338
- github_repo: str,
339
- model: str,
340
- severity: str,
341
- programming_language: str
342
- ):
343
- try:
344
- # Convert the synchronous call to async
345
- import asyncio
346
- return asyncio.run(respond(
347
- command=command,
348
- history=[],
349
- system_message=system_message,
350
- max_tokens=max_tokens,
351
- temperature=temperature,
352
- top_p=top_p,
353
- github_api_token=github_token,
354
- github_username=github_username,
355
- github_repository=github_repo,
356
- selected_model=model,
357
- severity=severity,
358
- programming_language=programming_language
359
- ))
360
- except Exception as e:
361
- return f"Error: {str(e)}"
 
 
 
362
 
363
- # Create the Gradio interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  with gr.Blocks(title="AI Assistant") as demo:
365
  gr.Markdown("""
366
  # AI Assistant
367
  Ask me anything, or use commands to interact with GitHub.
368
-
369
  Available commands:
370
  - `/github <username> <repo> <token>`: Connect to GitHub
371
  - `/help`: Show help
@@ -381,7 +401,7 @@ def create_gradio_interface():
381
  placeholder="Enter command (e.g., /help)",
382
  lines=2
383
  )
384
-
385
  system_message = gr.Textbox(
386
  label="System Message",
387
  value="You are a helpful AI assistant.",
 
327
  yield "I'm not sure what you mean. Try using `/help` for a list of available commands."
328
 
329
  def create_gradio_interface():
330
+ import gradio as gr
331
+ import asyncio
332
+
333
+ def process_command(
334
+ command: str,
335
+ system_message: str,
336
+ max_tokens: int,
337
+ temperature: float,
338
+ top_p: float,
339
+ github_token: str,
340
+ github_username: str,
341
+ github_repo: str,
342
+ model: str,
343
+ severity: str,
344
+ programming_language: str
345
+ ):
346
+ try:
347
+ # Convert the synchronous call to async
348
+ import asyncio
349
+ return asyncio.run(respond(
350
+ command=command,
351
+ history=[],
352
+ system_message=system_message,
353
+ max_tokens=max_tokens,
354
+ temperature=temperature,
355
+ top_p=top_p,
356
+ github_api_token=github_token,
357
+ github_username=github_username,
358
+ github_repository=github_repo,
359
+ selected_model=model,
360
+ severity=severity,
361
+ programming_language=programming_language
362
+ ))
363
+ except Exception as e:
364
+ return f"Error: {str(e)}"
365
 
366
+ def respond(
367
+ command: str,
368
+ history: list,
369
+ system_message: str,
370
+ max_tokens: int,
371
+ temperature: float,
372
+ top_p: float,
373
+ github_api_token: str,
374
+ github_username: str,
375
+ github_repository: str,
376
+ selected_model: str,
377
+ severity: str,
378
+ programming_language: str
379
+ ):
380
+ # Simulate a response
381
+ return f"Response to '{command}'"
382
+
383
+ def create_gradio_interface():
384
  with gr.Blocks(title="AI Assistant") as demo:
385
  gr.Markdown("""
386
  # AI Assistant
387
  Ask me anything, or use commands to interact with GitHub.
388
+
389
  Available commands:
390
  - `/github <username> <repo> <token>`: Connect to GitHub
391
  - `/help`: Show help
 
401
  placeholder="Enter command (e.g., /help)",
402
  lines=2
403
  )
404
+
405
  system_message = gr.Textbox(
406
  label="System Message",
407
  value="You are a helpful AI assistant.",