Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,58 +1,53 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from lucius_agent import call_lucius
|
| 3 |
from frontinus_agent import generate_docs
|
| 4 |
from copilot_promptor import generate_prompt
|
| 5 |
|
| 6 |
-
# System Prompt pre Primus
|
| 7 |
SYSTEM_PROMPT = """
|
| 8 |
-
Ty si Primus, hlavný orchestrátor Aethero Orchestra
|
| 9 |
-
|
| 10 |
-
a poskytnúť štruktúrovaný výstup vedomia AetheroOS. Zachovaj syntaktickú čistotu a harmóniu.
|
| 11 |
"""
|
| 12 |
|
| 13 |
def orchestrate_chat(system_prompt, user_input, max_tokens=1024, temperature=0.7, top_p=0.9):
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
docs_output = generate_docs(lucius_output, max_tokens=max_tokens, temperature=temperature)
|
| 19 |
-
prompt_output = generate_prompt(lucius_output) # 👈 odstránený top_p
|
| 20 |
-
|
| 21 |
-
# Zhrnutie výstupu
|
| 22 |
-
output = f"""
|
| 23 |
-
=== Aethero Orchestra Výstup ===
|
| 24 |
-
Prezidentov vstup: {user_input}
|
| 25 |
-
Systémový prompt: {system_prompt}
|
| 26 |
-
|
| 27 |
-
Lucius analýza:
|
| 28 |
-
- Intent: {lucius_output.get('intent', 'Nezistený')}
|
| 29 |
-
- Focus: {lucius_output.get('focus', 'Nezistený')}
|
| 30 |
-
- Direktívy: {lucius_output.get('structure', {}).get('directives', ['Žiadne'])}
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
"""
|
| 37 |
-
return output
|
| 38 |
|
| 39 |
-
# Gradio UI definícia
|
| 40 |
with gr.Blocks(title="Aethero Orchestra") as demo:
|
| 41 |
with gr.Row():
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
|
| 58 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import json
|
| 3 |
from lucius_agent import call_lucius
|
| 4 |
from frontinus_agent import generate_docs
|
| 5 |
from copilot_promptor import generate_prompt
|
| 6 |
|
|
|
|
| 7 |
SYSTEM_PROMPT = """
|
| 8 |
+
Ty si Primus, hlavný orchestrátor Aethero Orchestra. Koordinuješ Luciusa, Frontinusa a Copilota.
|
| 9 |
+
Syntetizuj vstupy prezidenta, volaj agentov a generuj štruktúrované výstupy pre AetheroOS.
|
|
|
|
| 10 |
"""
|
| 11 |
|
| 12 |
def orchestrate_chat(system_prompt, user_input, max_tokens=1024, temperature=0.7, top_p=0.9):
|
| 13 |
+
try:
|
| 14 |
+
parsed = json.loads(user_input)
|
| 15 |
+
except json.JSONDecodeError:
|
| 16 |
+
return "❌ Nevalidný JSON. Skontroluj syntax."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
lucius_output = call_lucius(parsed)
|
| 19 |
+
docs_output = generate_docs(lucius_output, max_tokens=max_tokens, temperature=temperature)
|
| 20 |
+
prompt_output = generate_prompt(lucius_output)
|
| 21 |
+
|
| 22 |
+
return f"""
|
| 23 |
+
=== Výstup Aethero Orchestra ===
|
| 24 |
+
🎯 Intent: {parsed.get("intent", "nezistený")}
|
| 25 |
+
📌 Focus: {parsed.get("focus", "nezistený")}
|
| 26 |
+
🧠 Emócie: {parsed.get("emotional_state", "neurčené")}
|
| 27 |
+
🗂️ Direktíva: {parsed.get("system_directive", "—")}
|
| 28 |
+
|
| 29 |
+
🧠 Lucius: {lucius_output}
|
| 30 |
+
📄 Dokumentácia: {docs_output}
|
| 31 |
+
🧾 Prompt: {prompt_output}
|
| 32 |
+
==============================
|
| 33 |
"""
|
|
|
|
| 34 |
|
|
|
|
| 35 |
with gr.Blocks(title="Aethero Orchestra") as demo:
|
| 36 |
with gr.Row():
|
| 37 |
+
input_text = gr.Textbox(label="🎙️ Prezidentov Vstup", lines=10, placeholder="{ JSON prompt }")
|
| 38 |
+
with gr.Row():
|
| 39 |
+
system_prompt = gr.Textbox(label="📜 Orchestrálna Identita", value=SYSTEM_PROMPT)
|
| 40 |
+
with gr.Row():
|
| 41 |
+
max_tokens = gr.Slider(256, 4096, value=1024, label="🧱 Max Tokens")
|
| 42 |
+
temperature = gr.Slider(0.1, 1.5, value=0.7, label="🔥 Temperature")
|
| 43 |
+
top_p = gr.Slider(0.1, 1.0, value=0.9, label="🌊 Top-p")
|
| 44 |
+
with gr.Row():
|
| 45 |
+
output_text = gr.Textbox(label="🧠 Výstup Orchestru", lines=18)
|
| 46 |
+
with gr.Row():
|
| 47 |
+
gr.Button("🟩 Spusti Orchestráciu").click(
|
| 48 |
+
fn=orchestrate_chat,
|
| 49 |
+
inputs=[system_prompt, input_text, max_tokens, temperature, top_p],
|
| 50 |
+
outputs=output_text
|
| 51 |
+
)
|
| 52 |
|
| 53 |
demo.launch()
|