File size: 1,056 Bytes
7f5ef51 |
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 |
import tkinter as tk from tkinter import messagebox import asyncio from ai_system.ai_core import AICore class AIApplication(tk.Tk): def __init__(self): super().__init__() self.ai = AICore() self.title("AI Assistant - Ultimate Edition") self.geometry("1200x700") self._init_ui() def _init_ui(self): self.query_entry = tk.Entry(self, width=100) self.query_entry.pack(pady=10) tk.Button(self, text="Submit", command=self._submit_query).pack() self.response_area = tk.Text(self, width=120, height=30) self.response_area.pack(pady=10) def _submit_query(self): query = self.query_entry.get() if not query: return async def process(): result = await self.ai.generate_response(query, 1) self.response_area.insert(tk.END, f"Response: {result['response']} ") asyncio.run_coroutine_threadsafe(process(), asyncio.get_event_loop()) if __name__ == "__main__": app = AIApplication() app.mainloop() |