Spaces:
Sleeping
Sleeping
Aiswarya Sankar
commited on
Commit
·
6cc9e67
1
Parent(s):
0121f51
update file
Browse files
app.py
CHANGED
@@ -381,10 +381,7 @@ def solveGithubIssue(ticket, history) -> Response:
|
|
381 |
"""
|
382 |
This endpoint takes in a github issue and then queries the db for the question against the codebase.
|
383 |
"""
|
384 |
-
# global repoName
|
385 |
repoName = repo_name.value
|
386 |
-
# ticket_choices = git_tickets.value
|
387 |
-
# global ticket_choices
|
388 |
github = repoName[:-4]
|
389 |
|
390 |
repoFolder = github.split("/")[-1]
|
@@ -431,7 +428,8 @@ def solveGithubIssue(ticket, history) -> Response:
|
|
431 |
|
432 |
history = [[q_display, ""]]
|
433 |
history[-1][1] = ""
|
434 |
-
|
|
|
435 |
history[-1][1] += char
|
436 |
time.sleep(0.01)
|
437 |
yield history
|
@@ -478,6 +476,7 @@ def bot(history, **kwargs):
|
|
478 |
print("Exception: " + str(e))
|
479 |
return str(e)
|
480 |
|
|
|
481 |
history[-1][1] = ""
|
482 |
for char in qa({"question": user_message, "chat_history": chat_history})["answer"]:
|
483 |
print(char)
|
@@ -521,35 +520,15 @@ with gr.Blocks() as demo:
|
|
521 |
|
522 |
# Display the titles in the dropdown
|
523 |
def create_ticket_dropdown():
|
524 |
-
|
525 |
-
# ticket_choices = {git_tickets.value["title"]: ticket for ticket in tickets}
|
526 |
-
# ticket_titles = [git_tickets.value["title"] for ticket in tickets]
|
527 |
-
|
528 |
-
# return git_ticket_choices.value
|
529 |
-
# ticketDropdown = gr.Dropdown(choices=git_titles.value, title="Github Issues", visible=False)
|
530 |
-
print("git titles")
|
531 |
-
print(git_titles.value)
|
532 |
return ticketDropdown.update(
|
533 |
choices=git_titles.value
|
534 |
)
|
535 |
|
536 |
-
# global ticket_choices, ticket_titles, tickets
|
537 |
-
# repo = "/".join(repo_name.value[:-4].split("/")[-2:])
|
538 |
-
# tickets = fetchGithubIssues(repo, 10)
|
539 |
-
|
540 |
-
# Create the dropdown
|
541 |
-
# ticket_choices = {git_tickets.value["title"]: ticket for ticket in tickets}
|
542 |
-
# ticket_titles = [git_tickets.value["title"] for ticket in tickets]
|
543 |
ticketDropdown = gr.Dropdown(choices=[], title="Github Issues", interactive=True)
|
544 |
ticketDropdown.focus(create_ticket_dropdown, outputs=ticketDropdown)
|
545 |
-
# ingestTickets = gr.Button("Ingest github tickets").click(create_ticket_dropdown, inputs=[], outputs=ticketDropdown) # (fetchGithubIssues).then
|
546 |
-
|
547 |
-
# Extract the ticket title, body for the selected ticket
|
548 |
chatbot = gr.Chatbot()
|
549 |
msg = gr.Textbox()
|
550 |
-
|
551 |
clear = gr.Button("Clear")
|
552 |
-
|
553 |
ticketDropdown.change(solveGithubIssue, inputs=[ticketDropdown, chatbot], outputs=[chatbot])
|
554 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
555 |
bot, chatbot, chatbot
|
|
|
381 |
"""
|
382 |
This endpoint takes in a github issue and then queries the db for the question against the codebase.
|
383 |
"""
|
|
|
384 |
repoName = repo_name.value
|
|
|
|
|
385 |
github = repoName[:-4]
|
386 |
|
387 |
repoFolder = github.split("/")[-1]
|
|
|
428 |
|
429 |
history = [[q_display, ""]]
|
430 |
history[-1][1] = ""
|
431 |
+
print(history)
|
432 |
+
for char in qa({"question": question, "chat_history": chat_history})["answer"]:
|
433 |
history[-1][1] += char
|
434 |
time.sleep(0.01)
|
435 |
yield history
|
|
|
476 |
print("Exception: " + str(e))
|
477 |
return str(e)
|
478 |
|
479 |
+
print(history)
|
480 |
history[-1][1] = ""
|
481 |
for char in qa({"question": user_message, "chat_history": chat_history})["answer"]:
|
482 |
print(char)
|
|
|
520 |
|
521 |
# Display the titles in the dropdown
|
522 |
def create_ticket_dropdown():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
523 |
return ticketDropdown.update(
|
524 |
choices=git_titles.value
|
525 |
)
|
526 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
ticketDropdown = gr.Dropdown(choices=[], title="Github Issues", interactive=True)
|
528 |
ticketDropdown.focus(create_ticket_dropdown, outputs=ticketDropdown)
|
|
|
|
|
|
|
529 |
chatbot = gr.Chatbot()
|
530 |
msg = gr.Textbox()
|
|
|
531 |
clear = gr.Button("Clear")
|
|
|
532 |
ticketDropdown.change(solveGithubIssue, inputs=[ticketDropdown, chatbot], outputs=[chatbot])
|
533 |
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
|
534 |
bot, chatbot, chatbot
|