Spaces:
Runtime error
Runtime error
Commit ·
8bed3b8
1
Parent(s): f91e3a6
Fix: 'HEADERS' not defined error by using DEEPSEEK_HEADERS from config.py in compassia.py.
Browse files- src/compassia.py +4 -3
src/compassia.py
CHANGED
|
@@ -30,7 +30,7 @@ import chromadb
|
|
| 30 |
|
| 31 |
# Import configurations and prompt from local modules
|
| 32 |
from config import (
|
| 33 |
-
DEEPSEEK_API_URL, DEEPSEEK_HEADERS,
|
| 34 |
EMBEDDING_MODEL_NAME, EMBEDDING_MODEL_USE_FP16,
|
| 35 |
CHROMADB_PERSIST_DIRECTORY, CHROMADB_COLLECTION_NAME,
|
| 36 |
CHUNK_SIZE, CHUNK_OVERLAP,
|
|
@@ -364,7 +364,8 @@ class DocumentRAG:
|
|
| 364 |
"max_tokens": LLM_MAX_TOKENS,
|
| 365 |
}
|
| 366 |
|
| 367 |
-
|
|
|
|
| 368 |
|
| 369 |
if response.status_code == 200:
|
| 370 |
ai_response = response.json()
|
|
@@ -479,4 +480,4 @@ if __name__ == "__main__":
|
|
| 479 |
# is handled on startup by `add_document` from Firestore.
|
| 480 |
answer_text, _ = rag_system.answer_question(user_question, conversation_id=current_conversation_id)
|
| 481 |
# For local testing, we print the answer directly
|
| 482 |
-
print(f"\nAI: {answer_text}")
|
|
|
|
| 30 |
|
| 31 |
# Import configurations and prompt from local modules
|
| 32 |
from config import (
|
| 33 |
+
DEEPSEEK_API_URL, DEEPSEEK_HEADERS, # <--- Using these from config.py
|
| 34 |
EMBEDDING_MODEL_NAME, EMBEDDING_MODEL_USE_FP16,
|
| 35 |
CHROMADB_PERSIST_DIRECTORY, CHROMADB_COLLECTION_NAME,
|
| 36 |
CHUNK_SIZE, CHUNK_OVERLAP,
|
|
|
|
| 364 |
"max_tokens": LLM_MAX_TOKENS,
|
| 365 |
}
|
| 366 |
|
| 367 |
+
# CRITICAL FIX: Use DEEPSEEK_HEADERS imported from config.py
|
| 368 |
+
response = requests.post(DEEPSEEK_API_URL, json=data, headers=DEEPSEEK_HEADERS)
|
| 369 |
|
| 370 |
if response.status_code == 200:
|
| 371 |
ai_response = response.json()
|
|
|
|
| 480 |
# is handled on startup by `add_document` from Firestore.
|
| 481 |
answer_text, _ = rag_system.answer_question(user_question, conversation_id=current_conversation_id)
|
| 482 |
# For local testing, we print the answer directly
|
| 483 |
+
print(f"\nAI: {answer_text}")
|