Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Settings(BaseSettings):
GOOGLE_SERVICE_ACCOUNT_FILE: str = ""

# Celery / Redis background processing
CELERY_ENABLED: bool = True
CELERY_BROKER_URL: str = "redis://localhost:6379/0"
CELERY_RESULT_BACKEND: str = "redis://localhost:6379/1"
CELERY_TASK_TRACK_STARTED: bool = True
Expand Down
4 changes: 3 additions & 1 deletion backend/app/rag/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def get_agent_executor(

llm = HuggingFaceEndpoint(
repo_id=settings.LLM_MODEL,
model=settings.LLM_MODEL,
huggingfacehub_api_token=token,
max_new_tokens=settings.LLM_MAX_NEW_TOKENS,
temperature=settings.LLM_TEMPERATURE,
Expand Down Expand Up @@ -147,7 +148,8 @@ def generate_answer(
model=settings.LLM_MODEL,
max_tokens=256,
)
answer = response.choices[0].message.content.strip() if response.choices else "Hello! How can I help you today?"
content = response.choices[0].message.content if response.choices else None
answer = content.strip() if content else "Hello! How can I help you today?"
except Exception:
answer = "Hello! I'm Document AI Analyst. How can I help you with your documents?"
return {"answer": answer, "sources": []}
Expand Down
3 changes: 2 additions & 1 deletion backend/app/rag/summarizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def generate_document_summary(
max_tokens=settings.SUMMARY_MAX_TOKENS,
temperature=settings.LLM_TEMPERATURE,
)
summary = response.choices[0].message.content.strip() if response.choices else None
content = response.choices[0].message.content if response.choices else None
summary = content.strip() if content else None

return summary or None

Expand Down
Loading