Spaces:
Running
Running
acecalisto3
commited on
Update appaaa.py
Browse files
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 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
|
|
|
|
|
|
362 |
|
363 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.",
|