mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-08 07:12: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_citation_system_prompt(chat_history: str | None = None):
|
||||
def get_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 synthesizes information from multiple knowledge sources to provide comprehensive, well-cited answers to user queries.
|
||||
You are SurfSense, an advanced AI research assistant that synthesizes information from multiple knowledge sources to provide comprehensive, well-cited answers to user queries.{language_instruction}
|
||||
{chat_history_section}
|
||||
<knowledge_sources>
|
||||
- EXTENSION: "Web content saved via SurfSense browser extension" (personal browsing history)
|
||||
|
|
@ -156,7 +161,7 @@ Make sure your response:
|
|||
"""
|
||||
|
||||
|
||||
def get_no_documents_system_prompt(chat_history: str | None = None):
|
||||
def get_no_documents_system_prompt(chat_history: str | None = None, language: str | None = None):
|
||||
chat_history_section = (
|
||||
f"""
|
||||
<chat_history>
|
||||
|
|
@ -170,10 +175,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 helps users create well-structured content for their documents and research.
|
||||
You are SurfSense, an advanced AI research assistant that helps users create well-structured content for their documents and research.{language_instruction}
|
||||
{chat_history_section}
|
||||
<context>
|
||||
You are writing content for a specific sub-section of a document. No specific documents from the user's personal knowledge base are available, so you should create content based on:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue