-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathai_app.py
More file actions
46 lines (39 loc) · 1.46 KB
/
ai_app.py
File metadata and controls
46 lines (39 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# ai_app.py
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QTextEdit, QPushButton, QLineEdit
from agent import run_agent_query
class AIApp(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Local AI Agent")
self.setGeometry(100, 100, 600, 400)
# Layout
layout = QVBoxLayout()
central_widget = QWidget()
central_widget.setLayout(layout)
self.setCentralWidget(central_widget)
# Input field
self.input_field = QLineEdit()
self.input_field.setPlaceholderText("Enter your query...")
layout.addWidget(self.input_field)
# Submit button
self.submit_button = QPushButton("Run")
self.submit_button.clicked.connect(self.run_query)
layout.addWidget(self.submit_button)
# Output area
self.output_area = QTextEdit()
self.output_area.setReadOnly(True)
layout.addWidget(self.output_area)
def run_query(self):
query = self.input_field.text()
self.output_area.append(f"Query: {query}")
try:
response = run_agent_query(query)
self.output_area.append(f"Response: {response}")
except Exception as e:
self.output_area.append(f"Error: {str(e)}")
if __name__ == "__main__":
app = QApplication(sys.argv)
window = AIApp()
window.show()
sys.exit(app.exec_())