Spaces:
Runtime error
Runtime error
Create chainlit_app.py
Browse files- chainlit_app.py +21 -0
chainlit_app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import chainlit as cl
|
| 2 |
+
import sys, os
|
| 3 |
+
|
| 4 |
+
# ─── Ensure utils/ is importable ──────────────────────────────
|
| 5 |
+
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
|
| 6 |
+
if ROOT_PATH not in sys.path:
|
| 7 |
+
sys.path.insert(0, ROOT_PATH)
|
| 8 |
+
|
| 9 |
+
from utils.backend import run_llm
|
| 10 |
+
|
| 11 |
+
@cl.on_chat_start
|
| 12 |
+
async def start():
|
| 13 |
+
await cl.Message(content="Hello 👋, I’m Omniscient! Ask me anything about logs, files, or scripts.").send()
|
| 14 |
+
|
| 15 |
+
@cl.on_message
|
| 16 |
+
async def main(message: cl.Message):
|
| 17 |
+
ai_input = message.content
|
| 18 |
+
reply = run_llm(ai_input)
|
| 19 |
+
|
| 20 |
+
# Send reply
|
| 21 |
+
await cl.Message(content=reply).send()
|