modified: blueprints/chat.py
modified: services/llm_service.py modified: services/rag_service.py modified: static/js/chat.js
This commit is contained in:
@@ -21,13 +21,14 @@ def _get_client():
|
||||
|
||||
if provider == "openai":
|
||||
api_key = current_app.config.get("OPENAI_API_KEY", "")
|
||||
_client = openai.OpenAI(api_key=api_key)
|
||||
_client = openai.OpenAI(api_key=api_key, timeout=60.0)
|
||||
else:
|
||||
# LM Studio or any OpenAI-compatible endpoint
|
||||
base_url = current_app.config.get("LM_STUDIO_URL", "http://localhost:1234")
|
||||
_client = openai.OpenAI(
|
||||
base_url=f"{base_url.rstrip('/')}/v1",
|
||||
api_key="lm-studio",
|
||||
timeout=60.0,
|
||||
)
|
||||
|
||||
return _client
|
||||
|
||||
@@ -20,7 +20,11 @@ class LMStudioEmbeddingFunction(EmbeddingFunction):
|
||||
"""ChromaDB-compatible embedding function that calls LM Studio's /v1/embeddings."""
|
||||
|
||||
def __init__(self, base_url: str, model: str):
|
||||
self._client = OpenAI(base_url=f"{base_url}/v1", api_key="lm-studio")
|
||||
self._client = OpenAI(
|
||||
base_url=f"{base_url}/v1",
|
||||
api_key="lm-studio",
|
||||
timeout=60.0,
|
||||
)
|
||||
self._model = model
|
||||
|
||||
def __call__(self, input: Documents) -> Embeddings:
|
||||
|
||||
Reference in New Issue
Block a user