Feature/memory work (#61)
* refactor(conversation): separate service and repository layers for conversation module - Split ConversationService and repository/UnitOfWork layers - Service layer now only handles business logic and orchestration - Repository layer handles all direct database operations - UnitOfWork encapsulates transactional operations for messages - Ensured all public methods have clear English docstrings with arguments, return values, and exceptions * feat(memory): implement work memory endpoints and services - Added API routes for conversation count, conversation list, messages, and detail. - Integrated ConversationService for database queries and LLM-based summary generation. * feat(memory): implement work memory endpoints and services - Added API routes for conversation count, conversation list, messages, and detail. - Integrated ConversationService for database queries and LLM-based summary generation. * feat(workflow): fix issues causing workflow failures if-else None value error knowledge empty list rerank end node output none node value assigner input none value * feat(memory): convert memory file creation time to timestamp and include title and first-line fields in file type * fix(memory): fix serialization output and default value issues * fix(workflow): fix issue with hybrid search logic in knowledge retrieval node
This commit is contained in:
@@ -3,9 +3,8 @@ import uuid
|
||||
from typing import Any, AsyncGenerator
|
||||
|
||||
import json_repair
|
||||
from langchain_core.prompts import ChatPromptTemplate
|
||||
from sqlalchemy.orm import Session
|
||||
from jinja2 import Template
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.error_codes import BizCode
|
||||
from app.core.exceptions import BusinessException
|
||||
@@ -177,11 +176,11 @@ class PromptOptimizerService:
|
||||
base_url=api_config.api_base
|
||||
), type=ModelType(model_config.type))
|
||||
try:
|
||||
with open('app/templates/prompt/prompt_optimizer_system.jinja2', 'r', encoding='utf-8') as f:
|
||||
with open('app/services/prompt/prompt_optimizer_system.jinja2', 'r', encoding='utf-8') as f:
|
||||
opt_system_prompt = f.read()
|
||||
rendered_system_message = Template(opt_system_prompt).render()
|
||||
|
||||
with open('app/templates/prompt/prompt_optimizer_user.jinja2', 'r', encoding='utf-8') as f:
|
||||
with open('app/services/prompt/prompt_optimizer_user.jinja2', 'r', encoding='utf-8') as f:
|
||||
opt_user_prompt = f.read()
|
||||
except FileNotFoundError:
|
||||
raise BusinessException(message="System prompt template not found", code=BizCode.NOT_FOUND)
|
||||
|
||||
Reference in New Issue
Block a user