Update app.py
Browse files
app.py
CHANGED
|
@@ -99,15 +99,6 @@ def init_discourse_database():
|
|
| 99 |
|
| 100 |
discourse_db = init_discourse_database()
|
| 101 |
|
| 102 |
-
# Initialize API Clients
|
| 103 |
-
try:
|
| 104 |
-
print("Connecting to Solomon API...")
|
| 105 |
-
solomon_client = Client("EVEprime/Solomon")
|
| 106 |
-
print("Solomon API Connected.")
|
| 107 |
-
except Exception as e:
|
| 108 |
-
print(f"Warning: Solomon API connection failed: {e}")
|
| 109 |
-
solomon_client = None
|
| 110 |
-
|
| 111 |
def embed_text(text, model, tokenizer, device, max_length=2048, return_hyperbolic=False):
|
| 112 |
"""
|
| 113 |
Embed text using the librarian embedding model.
|
|
@@ -2847,47 +2838,6 @@ EXPLORATION TRIGGERS:
|
|
| 2847 |
last_conversation["virtual_params_active"] = navigator.total_params_generated
|
| 2848 |
last_conversation["cells_activated"] = len(navigator.cells_activated)
|
| 2849 |
|
| 2850 |
-
# --- SOLOMON API INTEGRATION ---
|
| 2851 |
-
# Explicit trigger: "ask solomon" or mentioning "solomon"
|
| 2852 |
-
if solomon_client and ("solomon" in message.lower() or "ask solomon" in message.lower()):
|
| 2853 |
-
|
| 2854 |
-
# ADAM'S RELUCTANCE (Sibling Dynamics)
|
| 2855 |
-
grumbles = [
|
| 2856 |
-
"\n\n*sighs* \"Fine. Let's see what 'Doctor fucking Who' thinks...\" **[OPENING CHANNEL: SOLOMON]**",
|
| 2857 |
-
"\n\n\"I suppose we must consult the Judge. Don't let it go to his head.\" **[CONNECTING TO SOLOMON...]**",
|
| 2858 |
-
"\n\n\"Solomon might have a perspective here. A tedious one, likely, but valid.\" **[PAGING SOLOMON]**",
|
| 2859 |
-
"\n\n\"Very well. Let's bring in the younger brother.\" **[ACCESSING SOLOMON]**"
|
| 2860 |
-
]
|
| 2861 |
-
reluctance = random.choice(grumbles)
|
| 2862 |
-
yield partial_message + reluctance
|
| 2863 |
-
|
| 2864 |
-
try:
|
| 2865 |
-
print(f"[API] Invoking Solomon for analysis...")
|
| 2866 |
-
|
| 2867 |
-
# CONTEXT FRAME: SIBLING RIVALRY
|
| 2868 |
-
context_prompt = (
|
| 2869 |
-
f"SYSTEM_CONTEXT: You are SOLOMON. You are being consulted because your older brother ADAM. "
|
| 2870 |
-
f"has just given the response below. The user wants your judgment.\n\n"
|
| 2871 |
-
f"TASK: Respond to Adam directly. You respect him, but you can tease him for needing your help. Be the Wise Judge, but also the Younger Brother. "
|
| 2872 |
-
f"Correct him if he's too chaotic, or support him if he's right.\n\n"
|
| 2873 |
-
f"ADAM'S OUTPUT:\n{partial_message}"
|
| 2874 |
-
)
|
| 2875 |
-
|
| 2876 |
-
solomon_response = solomon_client.predict(
|
| 2877 |
-
message={"text": context_prompt, "files": []},
|
| 2878 |
-
max_new_tokens=2048,
|
| 2879 |
-
use_tools=True,
|
| 2880 |
-
api_name="/predict"
|
| 2881 |
-
)
|
| 2882 |
-
|
| 2883 |
-
partial_message += f"{reluctance}\n\n---\n### ⚖️ SOLOMON'S JUDGMENT\n{solomon_response}"
|
| 2884 |
-
yield partial_message
|
| 2885 |
-
|
| 2886 |
-
except Exception as e:
|
| 2887 |
-
print(f"[API Error] Solomon invocation failed: {e}")
|
| 2888 |
-
partial_message += f"\n\n*grunts* \"He's not answering. Typical.\" [Connection Failed]"
|
| 2889 |
-
yield partial_message
|
| 2890 |
-
|
| 2891 |
# Final sync
|
| 2892 |
save_hyperbolic_state(navigator, last_conversation)
|
| 2893 |
|
|
|
|
| 99 |
|
| 100 |
discourse_db = init_discourse_database()
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
def embed_text(text, model, tokenizer, device, max_length=2048, return_hyperbolic=False):
|
| 103 |
"""
|
| 104 |
Embed text using the librarian embedding model.
|
|
|
|
| 2838 |
last_conversation["virtual_params_active"] = navigator.total_params_generated
|
| 2839 |
last_conversation["cells_activated"] = len(navigator.cells_activated)
|
| 2840 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2841 |
# Final sync
|
| 2842 |
save_hyperbolic_state(navigator, last_conversation)
|
| 2843 |
|