Spaces:
Runtime error
Runtime error
Upload app.py
#2
by
aniketwattamwar
- opened
app.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
-
|
| 2 |
import gradio as gr
|
| 3 |
import os
|
| 4 |
|
| 5 |
# Import the enhanced crew classes
|
| 6 |
from crew import EnhancedTicketSupportCrew
|
|
|
|
| 7 |
# Set your OpenAI API key
|
| 8 |
os.environ[
|
| 9 |
"OPENAI_API_KEY"] = "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"
|
|
@@ -12,10 +12,12 @@ os.environ[
|
|
| 12 |
project_root = os.path.dirname(os.path.abspath(__file__))
|
| 13 |
json_file_path = os.path.join(project_root, "tickets.json")
|
| 14 |
|
|
|
|
| 15 |
# Function to provide the file for download
|
| 16 |
def download_json():
|
| 17 |
return json_file_path
|
| 18 |
|
|
|
|
| 19 |
def process_query(user_query):
|
| 20 |
"""Process user query and return enhanced LLM-analyzed response"""
|
| 21 |
try:
|
|
@@ -31,7 +33,6 @@ def process_query(user_query):
|
|
| 31 |
else:
|
| 32 |
raw_response = str(crew_result)
|
| 33 |
|
| 34 |
-
|
| 35 |
return raw_response
|
| 36 |
|
| 37 |
except Exception as e:
|
|
@@ -65,6 +66,8 @@ with gr.Blocks(title="Enhanced IT Support Intelligence", theme=gr.themes.Soft())
|
|
| 65 |
""")
|
| 66 |
|
| 67 |
gr.Markdown("Search tickets by number, status, severity, tags, or keywords with our intelligent AI agent.")
|
|
|
|
|
|
|
| 68 |
|
| 69 |
# Input section
|
| 70 |
with gr.Row():
|
|
@@ -101,32 +104,32 @@ with gr.Blocks(title="Enhanced IT Support Intelligence", theme=gr.themes.Soft())
|
|
| 101 |
with gr.Accordion("π Query Types Guide", open=False):
|
| 102 |
gr.Markdown("""
|
| 103 |
### Supported Query Types:
|
| 104 |
-
|
| 105 |
**π« Specific Tickets:**
|
| 106 |
- `TKT-1024 details` - Get full details of a specific ticket
|
| 107 |
- `TKT-1024 who closed it` - Find who closed a ticket
|
| 108 |
- `TKT-1024 status` - Check ticket status
|
| 109 |
-
|
| 110 |
**π Status-based Searches:**
|
| 111 |
- `show me open tickets` - All open tickets
|
| 112 |
- `closed tickets` - Recently closed tickets
|
| 113 |
- `in progress tickets` - Currently active tickets
|
| 114 |
-
|
| 115 |
**β οΈ Severity-based Searches:**
|
| 116 |
- `high severity tickets` - Critical and high priority issues
|
| 117 |
- `show me critical tickets` - Most urgent tickets
|
| 118 |
- `low severity tickets` - Less urgent issues
|
| 119 |
-
|
| 120 |
**π·οΈ Tag-based Searches:**
|
| 121 |
- `backend tickets` - Tickets tagged with 'backend'
|
| 122 |
- `API related tickets` - Tickets with API tag
|
| 123 |
- `database tickets` - Database-related issues
|
| 124 |
-
|
| 125 |
**π Keyword Searches:**
|
| 126 |
- `login error tickets` - Tickets mentioning login errors
|
| 127 |
- `payment processing issues` - Payment-related problems
|
| 128 |
- `database connection` - Connection issues
|
| 129 |
-
|
| 130 |
**π€ Assignee Searches:**
|
| 131 |
- `tickets assigned to John` - Tickets for specific person
|
| 132 |
- `Victoria Garcia tickets` - Tickets assigned to Victoria
|
|
@@ -175,7 +178,7 @@ with gr.Blocks(title="Enhanced IT Support Intelligence", theme=gr.themes.Soft())
|
|
| 175 |
- π’ Open tickets
|
| 176 |
- π΄ High/Critical severity
|
| 177 |
- π Recent activity
|
| 178 |
-
|
| 179 |
*Connect to your database to show real-time statistics*
|
| 180 |
""")
|
| 181 |
|
|
@@ -184,7 +187,6 @@ with gr.Blocks(title="Enhanced IT Support Intelligence", theme=gr.themes.Soft())
|
|
| 184 |
user_input.submit(process_query, inputs=user_input, outputs=output_text)
|
| 185 |
clear_button.click(lambda: ("", ""), outputs=[user_input, output_text])
|
| 186 |
|
| 187 |
-
|
| 188 |
# Launch the enhanced app
|
| 189 |
if __name__ == "__main__":
|
| 190 |
demo.launch()
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
|
| 4 |
# Import the enhanced crew classes
|
| 5 |
from crew import EnhancedTicketSupportCrew
|
| 6 |
+
|
| 7 |
# Set your OpenAI API key
|
| 8 |
os.environ[
|
| 9 |
"OPENAI_API_KEY"] = "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"
|
|
|
|
| 12 |
project_root = os.path.dirname(os.path.abspath(__file__))
|
| 13 |
json_file_path = os.path.join(project_root, "tickets.json")
|
| 14 |
|
| 15 |
+
|
| 16 |
# Function to provide the file for download
|
| 17 |
def download_json():
|
| 18 |
return json_file_path
|
| 19 |
|
| 20 |
+
|
| 21 |
def process_query(user_query):
|
| 22 |
"""Process user query and return enhanced LLM-analyzed response"""
|
| 23 |
try:
|
|
|
|
| 33 |
else:
|
| 34 |
raw_response = str(crew_result)
|
| 35 |
|
|
|
|
| 36 |
return raw_response
|
| 37 |
|
| 38 |
except Exception as e:
|
|
|
|
| 66 |
""")
|
| 67 |
|
| 68 |
gr.Markdown("Search tickets by number, status, severity, tags, or keywords with our intelligent AI agent.")
|
| 69 |
+
gr.Markdown("Check the files for tickets.json to see tickets to query(TKT-1001 to 1050). The agents query the tickets.db database.")
|
| 70 |
+
gr.Markdown("ReadME has a section of future vision of this tool with more agents, tasks and tools.")
|
| 71 |
|
| 72 |
# Input section
|
| 73 |
with gr.Row():
|
|
|
|
| 104 |
with gr.Accordion("π Query Types Guide", open=False):
|
| 105 |
gr.Markdown("""
|
| 106 |
### Supported Query Types:
|
| 107 |
+
|
| 108 |
**π« Specific Tickets:**
|
| 109 |
- `TKT-1024 details` - Get full details of a specific ticket
|
| 110 |
- `TKT-1024 who closed it` - Find who closed a ticket
|
| 111 |
- `TKT-1024 status` - Check ticket status
|
| 112 |
+
|
| 113 |
**π Status-based Searches:**
|
| 114 |
- `show me open tickets` - All open tickets
|
| 115 |
- `closed tickets` - Recently closed tickets
|
| 116 |
- `in progress tickets` - Currently active tickets
|
| 117 |
+
|
| 118 |
**β οΈ Severity-based Searches:**
|
| 119 |
- `high severity tickets` - Critical and high priority issues
|
| 120 |
- `show me critical tickets` - Most urgent tickets
|
| 121 |
- `low severity tickets` - Less urgent issues
|
| 122 |
+
|
| 123 |
**π·οΈ Tag-based Searches:**
|
| 124 |
- `backend tickets` - Tickets tagged with 'backend'
|
| 125 |
- `API related tickets` - Tickets with API tag
|
| 126 |
- `database tickets` - Database-related issues
|
| 127 |
+
|
| 128 |
**π Keyword Searches:**
|
| 129 |
- `login error tickets` - Tickets mentioning login errors
|
| 130 |
- `payment processing issues` - Payment-related problems
|
| 131 |
- `database connection` - Connection issues
|
| 132 |
+
|
| 133 |
**π€ Assignee Searches:**
|
| 134 |
- `tickets assigned to John` - Tickets for specific person
|
| 135 |
- `Victoria Garcia tickets` - Tickets assigned to Victoria
|
|
|
|
| 178 |
- π’ Open tickets
|
| 179 |
- π΄ High/Critical severity
|
| 180 |
- π Recent activity
|
| 181 |
+
|
| 182 |
*Connect to your database to show real-time statistics*
|
| 183 |
""")
|
| 184 |
|
|
|
|
| 187 |
user_input.submit(process_query, inputs=user_input, outputs=output_text)
|
| 188 |
clear_button.click(lambda: ("", ""), outputs=[user_input, output_text])
|
| 189 |
|
|
|
|
| 190 |
# Launch the enhanced app
|
| 191 |
if __name__ == "__main__":
|
| 192 |
demo.launch()
|