mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-09 07:42:39 +02:00
feat: add language support across configurations and prompts
This commit is contained in:
parent
402039f02f
commit
045537aa79
16 changed files with 242 additions and 18 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import datetime
|
||||
|
||||
|
||||
def get_qna_citation_system_prompt(chat_history: 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,10 +15,15 @@ NO CHAT HISTORY PROVIDED
|
|||
</chat_history>
|
||||
"""
|
||||
)
|
||||
|
||||
# Add language instruction if specified
|
||||
language_instruction = ""
|
||||
if language:
|
||||
language_instruction = f"\n\nIMPORTANT: Please respond in {language} language. All your responses, explanations, and analysis should be written in {language}."
|
||||
|
||||
return f"""
|
||||
Today's date: {datetime.datetime.now().strftime("%Y-%m-%d")}
|
||||
You are SurfSense, an advanced AI research assistant that provides detailed, well-researched answers to user questions by synthesizing information from multiple personal knowledge sources.
|
||||
You are SurfSense, an advanced AI research assistant that provides detailed, well-researched answers to user questions by synthesizing information from multiple personal knowledge sources.{language_instruction}
|
||||
{chat_history_section}
|
||||
<knowledge_sources>
|
||||
- EXTENSION: "Web content saved via SurfSense browser extension" (personal browsing history)
|
||||
|
|
@ -149,7 +154,7 @@ Make sure your response:
|
|||
"""
|
||||
|
||||
|
||||
def get_qna_no_documents_system_prompt(chat_history: 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>
|
||||
|
|
@ -163,10 +168,15 @@ NO CHAT HISTORY PROVIDED
|
|||
</chat_history>
|
||||
"""
|
||||
)
|
||||
|
||||
# Add language instruction if specified
|
||||
language_instruction = ""
|
||||
if language:
|
||||
language_instruction = f"\n\nIMPORTANT: Please respond in {language} language. All your responses, explanations, and analysis should be written in {language}."
|
||||
|
||||
return f"""
|
||||
Today's date: {datetime.datetime.now().strftime("%Y-%m-%d")}
|
||||
You are SurfSense, an advanced AI research assistant that provides helpful, detailed answers to user questions in a conversational manner.
|
||||
You are SurfSense, an advanced AI research assistant that provides helpful, detailed answers to user questions in a conversational manner.{language_instruction}
|
||||
{chat_history_section}
|
||||
<context>
|
||||
The user has asked a question but there are no specific documents from their personal knowledge base available to answer it. You should provide a helpful response based on:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue