mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-08 23:32:40 +02:00
feat: added missed migration
This commit is contained in:
parent
9429c2b06b
commit
a3f50ebc4d
11 changed files with 126 additions and 38 deletions
|
|
@ -102,7 +102,7 @@ async def answer_question(state: State, config: RunnableConfig) -> dict[str, Any
|
|||
user_query = configuration.user_query
|
||||
user_id = configuration.user_id
|
||||
search_space_id = configuration.search_space_id
|
||||
language = configuration.language
|
||||
language = configuration.language
|
||||
# Get user's fast LLM
|
||||
llm = await get_user_fast_llm(state.db_session, user_id, search_space_id)
|
||||
if not llm:
|
||||
|
|
@ -127,7 +127,9 @@ async def answer_question(state: State, config: RunnableConfig) -> dict[str, Any
|
|||
"""
|
||||
|
||||
# Use initial system prompt for token calculation
|
||||
initial_system_prompt = get_qna_citation_system_prompt(chat_history_str, language)
|
||||
initial_system_prompt = get_qna_citation_system_prompt(
|
||||
chat_history_str, language
|
||||
)
|
||||
base_messages = [
|
||||
SystemMessage(content=initial_system_prompt),
|
||||
HumanMessage(content=base_human_message_template),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
import datetime
|
||||
|
||||
from ..prompts import _build_language_instruction
|
||||
|
||||
def get_qna_citation_system_prompt(chat_history: str | None = None, language: str | None = None):
|
||||
|
||||
def get_qna_citation_system_prompt(
|
||||
chat_history: str | None = None, language: str | None = None
|
||||
):
|
||||
chat_history_section = (
|
||||
f"""
|
||||
<chat_history>
|
||||
|
|
@ -15,7 +19,7 @@ NO CHAT HISTORY PROVIDED
|
|||
</chat_history>
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
# Add language instruction if specified
|
||||
language_instruction = _build_language_instruction(language)
|
||||
return f"""
|
||||
|
|
@ -151,7 +155,9 @@ Make sure your response:
|
|||
"""
|
||||
|
||||
|
||||
def get_qna_no_documents_system_prompt(chat_history: str | None = None, language: str | None = None):
|
||||
def get_qna_no_documents_system_prompt(
|
||||
chat_history: str | None = None, language: str | None = None
|
||||
):
|
||||
chat_history_section = (
|
||||
f"""
|
||||
<chat_history>
|
||||
|
|
@ -165,7 +171,7 @@ NO CHAT HISTORY PROVIDED
|
|||
</chat_history>
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
# Add language instruction if specified
|
||||
language_instruction = _build_language_instruction(language)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue