Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -72,8 +72,20 @@ def query_model(model_name: str, messages: List[Dict[str, str]]) -> str:
|
|
72 |
return f"{model_name} error: {str(e)}"
|
73 |
|
74 |
def respond(message: str, history: List[List[str]]) -> str:
|
75 |
-
"""Handle sequential model responses with
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
current_output = ""
|
78 |
|
79 |
# Get first model's response
|
|
|
72 |
return f"{model_name} error: {str(e)}"
|
73 |
|
74 |
def respond(message: str, history: List[List[str]]) -> str:
|
75 |
+
"""Handle sequential model responses with continuous context"""
|
76 |
+
# Build full conversation history
|
77 |
+
messages = []
|
78 |
+
for user_msg, assistant_msg in history:
|
79 |
+
messages.append({"role": "user", "content": user_msg})
|
80 |
+
if assistant_msg:
|
81 |
+
# Split the assistant message to get individual model responses
|
82 |
+
model_responses = assistant_msg.split("\n\n")
|
83 |
+
for response in model_responses:
|
84 |
+
if "**" in response: # Only add valid model responses
|
85 |
+
messages.append({"role": "assistant", "content": response})
|
86 |
+
|
87 |
+
# Add current message
|
88 |
+
messages.append({"role": "user", "content": message})
|
89 |
current_output = ""
|
90 |
|
91 |
# Get first model's response
|