Spaces:
Running
Running
milwright
commited on
Commit
·
0c10613
1
Parent(s):
d3a61af
append file uploads to system message for consistency
Browse files- space_template.py +6 -8
space_template.py
CHANGED
|
@@ -402,10 +402,12 @@ Get your API key at: https://openrouter.ai/keys"""
|
|
| 402 |
dynamic_context += f"\\n{{content}}"
|
| 403 |
grounding_context += dynamic_context
|
| 404 |
|
| 405 |
-
# Build messages with grounding context in system prompt
|
| 406 |
system_content = SYSTEM_PROMPT
|
| 407 |
if grounding_context:
|
| 408 |
-
system_content = f"{{
|
|
|
|
|
|
|
| 409 |
|
| 410 |
messages = [{{"role": "system", "content": system_content}}]
|
| 411 |
|
|
@@ -417,14 +419,10 @@ Get your API key at: https://openrouter.ai/keys"""
|
|
| 417 |
"content": msg['content']
|
| 418 |
}})
|
| 419 |
|
| 420 |
-
# Add current message
|
| 421 |
-
full_message = message
|
| 422 |
-
if file_context:
|
| 423 |
-
full_message = f"{{file_context}}\\n\\n{{message}}"
|
| 424 |
-
|
| 425 |
messages.append({{
|
| 426 |
"role": "user",
|
| 427 |
-
"content":
|
| 428 |
}})
|
| 429 |
|
| 430 |
# Make API request
|
|
|
|
| 402 |
dynamic_context += f"\\n{{content}}"
|
| 403 |
grounding_context += dynamic_context
|
| 404 |
|
| 405 |
+
# Build messages with grounding context and file context in system prompt
|
| 406 |
system_content = SYSTEM_PROMPT
|
| 407 |
if grounding_context:
|
| 408 |
+
system_content = f"{{system_content}}\\n\\n{{grounding_context}}"
|
| 409 |
+
if file_context:
|
| 410 |
+
system_content = f"{{system_content}}\\n\\n{{file_context}}"
|
| 411 |
|
| 412 |
messages = [{{"role": "system", "content": system_content}}]
|
| 413 |
|
|
|
|
| 419 |
"content": msg['content']
|
| 420 |
}})
|
| 421 |
|
| 422 |
+
# Add current message
|
|
|
|
|
|
|
|
|
|
|
|
|
| 423 |
messages.append({{
|
| 424 |
"role": "user",
|
| 425 |
+
"content": message
|
| 426 |
}})
|
| 427 |
|
| 428 |
# Make API request
|