Implement KB features with codex
This commit is contained in:
@@ -68,6 +68,14 @@ def _resolve_runtime_metadata(db: Session, assistant: Assistant) -> dict:
|
||||
}
|
||||
warnings.append(f"Voice resource not found: {assistant.voice}")
|
||||
|
||||
if assistant.knowledge_base_id:
|
||||
metadata["knowledgeBaseId"] = assistant.knowledge_base_id
|
||||
metadata["knowledge"] = {
|
||||
"enabled": True,
|
||||
"kbId": assistant.knowledge_base_id,
|
||||
"nResults": 5,
|
||||
}
|
||||
|
||||
return {
|
||||
"assistantId": assistant.id,
|
||||
"sessionStartMetadata": metadata,
|
||||
@@ -75,6 +83,7 @@ def _resolve_runtime_metadata(db: Session, assistant: Assistant) -> dict:
|
||||
"llmModelId": assistant.llm_model_id,
|
||||
"asrModelId": assistant.asr_model_id,
|
||||
"voiceId": assistant.voice,
|
||||
"knowledgeBaseId": assistant.knowledge_base_id,
|
||||
},
|
||||
"warnings": warnings,
|
||||
}
|
||||
|
||||
@@ -119,6 +119,14 @@ class TestAssistantAPI:
|
||||
assert response.status_code == 200
|
||||
assert response.json()["knowledgeBaseId"] == "non-existent-kb"
|
||||
|
||||
assistant_id = response.json()["id"]
|
||||
runtime_resp = client.get(f"/api/assistants/{assistant_id}/runtime-config")
|
||||
assert runtime_resp.status_code == 200
|
||||
metadata = runtime_resp.json()["sessionStartMetadata"]
|
||||
assert metadata["knowledgeBaseId"] == "non-existent-kb"
|
||||
assert metadata["knowledge"]["enabled"] is True
|
||||
assert metadata["knowledge"]["kbId"] == "non-existent-kb"
|
||||
|
||||
def test_assistant_with_model_references(self, client, sample_assistant_data):
|
||||
"""Test creating assistant with model references"""
|
||||
sample_assistant_data.update({
|
||||
|
||||
Reference in New Issue
Block a user