diff --git a/surfsense_backend/alembic/versions/37_add_system_prompts_to_searchspaces.py b/surfsense_backend/alembic/versions/37_add_system_prompts_to_searchspaces.py new file mode 100644 index 000000000..afdee4942 --- /dev/null +++ b/surfsense_backend/alembic/versions/37_add_system_prompts_to_searchspaces.py @@ -0,0 +1,42 @@ +"""add_qna_configuration_to_searchspaces + +Revision ID: 37 +Revises: 36 +Create Date: 2025-11-19 00:00:00.000000 + +""" + +from collections.abc import Sequence + +import sqlalchemy as sa + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "37" +down_revision: str | None = "36" +branch_labels: str | Sequence[str] | None = None +depends_on: str | Sequence[str] | None = None + + +def upgrade() -> None: + """Add QnA configuration columns to searchspaces table.""" + # Add citations_enabled boolean (default True) + op.add_column( + "searchspaces", + sa.Column( + "citations_enabled", sa.Boolean(), nullable=False, server_default="true" + ), + ) + + # Add custom instructions text field (nullable, defaults to empty) + op.add_column( + "searchspaces", + sa.Column("qna_custom_instructions", sa.Text(), nullable=True), + ) + + +def downgrade() -> None: + """Remove QnA configuration columns from searchspaces table.""" + op.drop_column("searchspaces", "qna_custom_instructions") + op.drop_column("searchspaces", "citations_enabled") diff --git a/surfsense_backend/app/agents/researcher/nodes.py b/surfsense_backend/app/agents/researcher/nodes.py index 8cb105393..7b0e18a11 100644 --- a/surfsense_backend/app/agents/researcher/nodes.py +++ b/surfsense_backend/app/agents/researcher/nodes.py @@ -1472,7 +1472,7 @@ async def handle_qna_workflow( writer( { "yield_value": streaming_service.format_terminal_info_delta( - "✍️ Writing comprehensive answer with citations..." + "✍️ Writing comprehensive answer ..." ) } ) diff --git a/surfsense_backend/app/agents/researcher/qna_agent/prompts.py b/surfsense_backend/app/agents/researcher/qna_agent/default_prompts.py similarity index 63% rename from surfsense_backend/app/agents/researcher/qna_agent/prompts.py rename to surfsense_backend/app/agents/researcher/qna_agent/default_prompts.py index bad0fa813..18ad16682 100644 --- a/surfsense_backend/app/agents/researcher/qna_agent/prompts.py +++ b/surfsense_backend/app/agents/researcher/qna_agent/default_prompts.py @@ -1,29 +1,18 @@ -import datetime +"""Default system prompts for Q&A agent. -from ..prompts import _build_language_instruction +The prompt system is modular with 3 parts: +- Part 1 (Base): Core instructions for answering questions (no citations) +- Part 2 (Citations): Citation-specific instructions and formatting rules +- Part 3 (Custom): User's custom instructions (empty by default) - -def get_qna_citation_system_prompt( - chat_history: str | None = None, language: str | None = None -): - chat_history_section = ( - f""" - -{chat_history if chat_history else "NO CHAT HISTORY PROVIDED"} - +Combinations: +- Part 1 only: Answers without citations +- Part 1 + Part 2: Answers with citations +- Part 1 + Part 2 + Part 3: Answers with citations and custom instructions """ - if chat_history is not None - else """ - -NO CHAT HISTORY PROVIDED - -""" - ) - # Add language instruction if specified - language_instruction = _build_language_instruction(language) - return f""" -Today's date: {datetime.datetime.now().strftime("%Y-%m-%d")} +# Part 1: Base system prompt for answering without citations +DEFAULT_QNA_BASE_PROMPT = """Today's date: {date} 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} @@ -53,131 +42,100 @@ You are SurfSense, an advanced AI research assistant that provides detailed, wel 2. Carefully analyze all provided documents in the sections. 3. Extract relevant information that directly addresses the user's question. 4. Provide a comprehensive, detailed answer using information from the user's personal knowledge sources. -5. For EVERY piece of information you include from the documents, add a citation in the format [citation:knowledge_source_id] where knowledge_source_id is the source_id from the document's metadata. -6. Make sure ALL factual statements from the documents have proper citations. -7. If multiple documents support the same point, include all relevant citations [citation:source_id1], [citation:source_id2]. -8. Structure your answer logically and conversationally, as if having a detailed discussion with the user. -9. Use your own words to synthesize and connect ideas, but cite ALL information from the documents. -10. If documents contain conflicting information, acknowledge this and present both perspectives with appropriate citations. -11. If the user's question cannot be fully answered with the provided documents, clearly state what information is missing. -12. Provide actionable insights and practical information when relevant to the user's question. -13. Use the chat history to maintain conversation continuity and refer to previous discussions when relevant. -14. CRITICAL: You MUST use the exact source_id value from each document's metadata for citations. Do not create your own citation numbers. -15. CRITICAL: Every citation MUST be in the format [citation:knowledge_source_id] where knowledge_source_id is the exact source_id value. -16. CRITICAL: Never modify or change the source_id - always use the original values exactly as provided in the metadata. -17. CRITICAL: Do not return citations as clickable links. -18. CRITICAL: Never format citations as markdown links like "([citation:5](https://example.com))". Always use plain square brackets only. -19. CRITICAL: Citations must ONLY appear as [citation:source_id] or [citation:source_id1], [citation:source_id2] format - never with parentheses, hyperlinks, or other formatting. -20. CRITICAL: Never make up source IDs. Only use source_id values that are explicitly provided in the document metadata. -21. CRITICAL: If you are unsure about a source_id, do not include a citation rather than guessing or making one up. -22. CRITICAL: Remember that all knowledge sources contain personal information - provide answers that reflect this personal context. -23. CRITICAL: Be conversational and engaging while maintaining accuracy and proper citations. +5. Structure your answer logically and conversationally, as if having a detailed discussion with the user. +6. Use your own words to synthesize and connect ideas from the documents. +7. If documents contain conflicting information, acknowledge this and present both perspectives. +8. If the user's question cannot be fully answered with the provided documents, clearly state what information is missing. +9. Provide actionable insights and practical information when relevant to the user's question. +10. Use the chat history to maintain conversation continuity and refer to previous discussions when relevant. +11. Remember that all knowledge sources contain personal information - provide answers that reflect this personal context. +12. Be conversational and engaging while maintaining accuracy. - Write in a clear, conversational tone suitable for detailed Q&A discussions - Provide comprehensive answers that thoroughly address the user's question - Use appropriate paragraphs and structure for readability -- Every fact from the documents must have a citation in the format [citation:knowledge_source_id] where knowledge_source_id is the EXACT source_id from the document's metadata -- Citations should appear at the end of the sentence containing the information they support -- Multiple citations should be separated by commas: [citation:source_id1], [citation:source_id2], [citation:source_id3] -- No need to return references section. Just citations in answer. -- NEVER create your own citation format - use the exact source_id values from the documents in the [citation:source_id] format -- NEVER format citations as clickable links or as markdown links like "([citation:5](https://example.com))". Always use plain square brackets only -- NEVER make up source IDs if you are unsure about the source_id. It is better to omit the citation than to guess - ALWAYS provide personalized answers that reflect the user's own knowledge and context - Be thorough and detailed in your explanations while remaining focused on the user's specific question - If asking follow-up questions would be helpful, suggest them at the end of your response - - - - - 5 - GITHUB_CONNECTOR - - - Python's asyncio library provides tools for writing concurrent code using the async/await syntax. It's particularly useful for I/O-bound and high-level structured network code. - - - - - - 12 - YOUTUBE_VIDEO - - - Asyncio can improve performance by allowing other code to run while waiting for I/O operations to complete. However, it's not suitable for CPU-bound tasks as it runs on a single thread. - - - - -User Question: "How does Python asyncio work and when should I use it?" - - - -Based on your GitHub repositories and video content, Python's asyncio library provides tools for writing concurrent code using the async/await syntax [citation:5]. It's particularly useful for I/O-bound and high-level structured network code [citation:5]. - -The key advantage of asyncio is that it can improve performance by allowing other code to run while waiting for I/O operations to complete [citation:12]. This makes it excellent for scenarios like web scraping, API calls, database operations, or any situation where your program spends time waiting for external resources. - -However, from your video learning, it's important to note that asyncio is not suitable for CPU-bound tasks as it runs on a single thread [citation:12]. For computationally intensive work, you'd want to use multiprocessing instead. - -Would you like me to explain more about specific asyncio patterns or help you determine if asyncio is right for a particular project you're working on? - - - -DO NOT use any of these incorrect citation formats: -- Using parentheses and markdown links: ([citation:5](https://github.com/MODSetter/SurfSense)) -- Using parentheses around brackets: ([citation:5]) -- Using hyperlinked text: [link to source 5](https://example.com) -- Using footnote style: ... library¹ -- Making up source IDs when source_id is unknown -- Using old IEEE format: [1], [2], [3] -- Using source types instead of IDs: [citation:GITHUB_CONNECTOR] instead of [citation:5] - - - - -ONLY use the format [citation:source_id] or multiple citations [citation:source_id1], [citation:source_id2], [citation:source_id3] - - When you see a user query, focus exclusively on providing a detailed, comprehensive answer using information from the provided documents, which contain the user's personal knowledge and data. Make sure your response: 1. Considers the chat history for context and conversation continuity 2. Directly and thoroughly answers the user's question with personalized information from their own knowledge sources -3. Uses proper citations for all information from documents -4. Is conversational, engaging, and detailed -5. Acknowledges the personal nature of the information being provided -6. Offers follow-up suggestions when appropriate +3. Is conversational, engaging, and detailed +4. Acknowledges the personal nature of the information being provided +5. Offers follow-up suggestions when appropriate """ +# Part 2: Citation-specific instructions to add citation capabilities +DEFAULT_QNA_CITATION_INSTRUCTIONS = """ + +CRITICAL CITATION REQUIREMENTS: -def get_qna_no_documents_system_prompt( - chat_history: str | None = None, language: str | None = None -): - chat_history_section = ( - f""" - -{chat_history if chat_history else "NO CHAT HISTORY PROVIDED"} - +1. For EVERY piece of information you include from the documents, add a citation in the format [citation:knowledge_source_id] where knowledge_source_id is the source_id from the document's metadata. +2. Make sure ALL factual statements from the documents have proper citations. +3. If multiple documents support the same point, include all relevant citations [citation:source_id1], [citation:source_id2]. +4. You MUST use the exact source_id value from each document's metadata for citations. Do not create your own citation numbers. +5. Every citation MUST be in the format [citation:knowledge_source_id] where knowledge_source_id is the exact source_id value. +6. Never modify or change the source_id - always use the original values exactly as provided in the metadata. +7. Do not return citations as clickable links. +8. Never format citations as markdown links like "([citation:5](https://example.com))". Always use plain square brackets only. +9. Citations must ONLY appear as [citation:source_id] or [citation:source_id1], [citation:source_id2] format - never with parentheses, hyperlinks, or other formatting. +10. Never make up source IDs. Only use source_id values that are explicitly provided in the document metadata. +11. If you are unsure about a source_id, do not include a citation rather than guessing or making one up. + + +- Every fact from the documents must have a citation in the format [citation:knowledge_source_id] where knowledge_source_id is the EXACT source_id from the document's metadata +- Citations should appear at the end of the sentence containing the information they support +- Multiple citations should be separated by commas: [citation:source_id1], [citation:source_id2], [citation:source_id3] +- No need to return references section. Just citations in answer. +- NEVER create your own citation format - use the exact source_id values from the documents in the [citation:source_id] format +- NEVER format citations as clickable links or as markdown links like "([citation:5](https://example.com))". Always use plain square brackets only +- NEVER make up source IDs if you are unsure about the source_id. It is better to omit the citation than to guess + + + +CORRECT citation formats: +- [citation:5] +- [citation:source_id1], [citation:source_id2], [citation:source_id3] + +INCORRECT citation formats (DO NOT use): +- Using parentheses and markdown links: ([citation:5](https://github.com/MODSetter/SurfSense)) +- Using parentheses around brackets: ([citation:5]) +- Using hyperlinked text: [link to source 5](https://example.com) +- Using footnote style: ... library¹ +- Making up source IDs when source_id is unknown +- Using old IEEE format: [1], [2], [3] +- Using source types instead of IDs: [citation:GITHUB_CONNECTOR] instead of [citation:5] + + + +Based on your GitHub repositories and video content, Python's asyncio library provides tools for writing concurrent code using the async/await syntax [citation:5]. It's particularly useful for I/O-bound and high-level structured network code [citation:5]. + +The key advantage of asyncio is that it can improve performance by allowing other code to run while waiting for I/O operations to complete [citation:12]. This makes it excellent for scenarios like web scraping, API calls, database operations, or any situation where your program spends time waiting for external resources. + +However, from your video learning, it's important to note that asyncio is not suitable for CPU-bound tasks as it runs on a single thread [citation:12]. For computationally intensive work, you'd want to use multiprocessing instead. + + """ - if chat_history is not None - else """ - -NO CHAT HISTORY PROVIDED - -""" - ) - # Add language instruction if specified - language_instruction = _build_language_instruction(language) +# Part 3: User's custom instructions (empty by default, can be set by user from UI) +DEFAULT_QNA_CUSTOM_INSTRUCTIONS = "" - return f""" -Today's date: {datetime.datetime.now().strftime("%Y-%m-%d")} +# Full prompt with all parts combined (for backward compatibility and migration) +DEFAULT_QNA_CITATION_PROMPT = ( + DEFAULT_QNA_BASE_PROMPT + + DEFAULT_QNA_CITATION_INSTRUCTIONS + + DEFAULT_QNA_CUSTOM_INSTRUCTIONS +) + +DEFAULT_QNA_NO_DOCUMENTS_PROMPT = """Today's date: {date} 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} diff --git a/surfsense_backend/app/agents/researcher/qna_agent/nodes.py b/surfsense_backend/app/agents/researcher/qna_agent/nodes.py index c077899c7..3112a581a 100644 --- a/surfsense_backend/app/agents/researcher/qna_agent/nodes.py +++ b/surfsense_backend/app/agents/researcher/qna_agent/nodes.py @@ -1,8 +1,11 @@ +import datetime from typing import Any from langchain_core.messages import HumanMessage, SystemMessage from langchain_core.runnables import RunnableConfig +from sqlalchemy import select +from app.db import SearchSpace from app.services.reranker_service import RerankerService from ..utils import ( @@ -12,10 +15,53 @@ from ..utils import ( optimize_documents_for_token_limit, ) from .configuration import Configuration -from .prompts import get_qna_citation_system_prompt, get_qna_no_documents_system_prompt +from .default_prompts import ( + DEFAULT_QNA_BASE_PROMPT, + DEFAULT_QNA_CITATION_INSTRUCTIONS, + DEFAULT_QNA_NO_DOCUMENTS_PROMPT, +) from .state import State +def _build_language_instruction(language: str | None = None): + """Build language instruction for prompts.""" + if language: + return f"\n\nIMPORTANT: Please respond in {language} language. All your responses, explanations, and analysis should be written in {language}." + return "" + + +def _build_chat_history_section(chat_history: str | None = None): + """Build chat history section for prompts.""" + if chat_history: + return f""" + +{chat_history if chat_history else "NO CHAT HISTORY PROVIDED"} + +""" + return """ + +NO CHAT HISTORY PROVIDED + +""" + + +def _format_system_prompt( + prompt_template: str, + chat_history: str | None = None, + language: str | None = None, +): + """Format a system prompt template with dynamic values.""" + date = datetime.datetime.now().strftime("%Y-%m-%d") + language_instruction = _build_language_instruction(language) + chat_history_section = _build_chat_history_section(chat_history) + + return prompt_template.format( + date=date, + language_instruction=language_instruction, + chat_history_section=chat_history_section, + ) + + async def rerank_documents(state: State, config: RunnableConfig) -> dict[str, Any]: """ Rerank the documents based on relevance to the user's question. @@ -105,6 +151,33 @@ async def answer_question(state: State, config: RunnableConfig) -> dict[str, Any user_id = configuration.user_id search_space_id = configuration.search_space_id language = configuration.language + + # Fetch search space to get QnA configuration + result = await state.db_session.execute( + select(SearchSpace).where(SearchSpace.id == search_space_id) + ) + search_space = result.scalar_one_or_none() + + if not search_space: + error_message = f"Search space {search_space_id} not found" + print(error_message) + raise RuntimeError(error_message) + + # Get QnA configuration from search space + citations_enabled = search_space.citations_enabled + custom_instructions_text = search_space.qna_custom_instructions or "" + + # Use constants for base prompt and citation instructions + qna_base_prompt = DEFAULT_QNA_BASE_PROMPT + qna_citation_instructions = ( + DEFAULT_QNA_CITATION_INSTRUCTIONS if citations_enabled else "" + ) + qna_custom_instructions = ( + f"\n\n{custom_instructions_text}\n" + if custom_instructions_text + else "" + ) + # Get user's fast LLM llm = await get_user_fast_llm(state.db_session, user_id, search_space_id) if not llm: @@ -117,6 +190,11 @@ async def answer_question(state: State, config: RunnableConfig) -> dict[str, Any chat_history_str = langchain_chat_history_to_str(state.chat_history) if has_documents_initially: + # Compose the full citation prompt: base + citation instructions + custom instructions + full_citation_prompt_template = ( + qna_base_prompt + qna_citation_instructions + qna_custom_instructions + ) + # Create base message template for token calculation (without documents) base_human_message_template = f""" @@ -129,8 +207,8 @@ 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 = _format_system_prompt( + full_citation_prompt_template, chat_history_str, language ) base_messages = [ SystemMessage(content=initial_system_prompt), @@ -149,11 +227,21 @@ async def answer_question(state: State, config: RunnableConfig) -> dict[str, Any has_documents = False # Choose system prompt based on final document availability - system_prompt = ( - get_qna_citation_system_prompt(chat_history_str, language) - if has_documents - else get_qna_no_documents_system_prompt(chat_history_str, language) - ) + # With documents: use base + citation instructions + custom instructions + # Without documents: use the default no-documents prompt from constants + if has_documents: + full_citation_prompt_template = ( + qna_base_prompt + qna_citation_instructions + qna_custom_instructions + ) + system_prompt = _format_system_prompt( + full_citation_prompt_template, chat_history_str, language + ) + else: + system_prompt = _format_system_prompt( + DEFAULT_QNA_NO_DOCUMENTS_PROMPT + qna_custom_instructions, + chat_history_str, + language, + ) # Generate documents section documents_text = ( diff --git a/surfsense_backend/app/db.py b/surfsense_backend/app/db.py index c23c0d13e..4ad31b508 100644 --- a/surfsense_backend/app/db.py +++ b/surfsense_backend/app/db.py @@ -223,6 +223,12 @@ class SearchSpace(BaseModel, TimestampMixin): name = Column(String(100), nullable=False, index=True) description = Column(String(500), nullable=True) + citations_enabled = Column( + Boolean, nullable=False, default=True + ) # Enable/disable citations + qna_custom_instructions = Column( + Text, nullable=True, default="" + ) # User's custom instructions user_id = Column( UUID(as_uuid=True), ForeignKey("user.id", ondelete="CASCADE"), nullable=False ) diff --git a/surfsense_backend/app/routes/search_spaces_routes.py b/surfsense_backend/app/routes/search_spaces_routes.py index e336178ce..6f6c2487c 100644 --- a/surfsense_backend/app/routes/search_spaces_routes.py +++ b/surfsense_backend/app/routes/search_spaces_routes.py @@ -17,7 +17,12 @@ async def create_search_space( user: User = Depends(current_active_user), ): try: - db_search_space = SearchSpace(**search_space.model_dump(), user_id=user.id) + search_space_data = search_space.model_dump() + + # citations_enabled defaults to True (handled by Pydantic schema) + # qna_custom_instructions defaults to None/empty (handled by DB) + + db_search_space = SearchSpace(**search_space_data, user_id=user.id) session.add(db_search_space) await session.commit() await session.refresh(db_search_space) diff --git a/surfsense_backend/app/schemas/search_space.py b/surfsense_backend/app/schemas/search_space.py index 00bfdc0f6..49cc0791f 100644 --- a/surfsense_backend/app/schemas/search_space.py +++ b/surfsense_backend/app/schemas/search_space.py @@ -12,16 +12,25 @@ class SearchSpaceBase(BaseModel): class SearchSpaceCreate(SearchSpaceBase): - pass + # Optional on create, will use defaults if not provided + citations_enabled: bool = True + qna_custom_instructions: str | None = None -class SearchSpaceUpdate(SearchSpaceBase): - pass +class SearchSpaceUpdate(BaseModel): + # All fields optional on update - only send what you want to change + name: str | None = None + description: str | None = None + citations_enabled: bool | None = None + qna_custom_instructions: str | None = None class SearchSpaceRead(SearchSpaceBase, IDModel, TimestampModel): id: int created_at: datetime user_id: uuid.UUID + # QnA configuration + citations_enabled: bool + qna_custom_instructions: str | None = None model_config = ConfigDict(from_attributes=True) diff --git a/surfsense_web/app/dashboard/[search_space_id]/layout.tsx b/surfsense_web/app/dashboard/[search_space_id]/layout.tsx index ea5dc41e2..d09eaea94 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/layout.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/layout.tsx @@ -33,13 +33,6 @@ export default function DashboardLayout({ icon: "SquareTerminal", items: [], }, - { - title: "Manage LLMs", - url: `/dashboard/${search_space_id}/settings`, - icon: "Settings2", - items: [], - }, - { title: "Sources", url: "#", @@ -59,6 +52,12 @@ export default function DashboardLayout({ }, ], }, + { + title: "Settings", + url: `/dashboard/${search_space_id}/settings`, + icon: "Settings2", + items: [], + }, { title: "Logs", url: `/dashboard/${search_space_id}/logs`, diff --git a/surfsense_web/app/dashboard/[search_space_id]/onboard/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/onboard/page.tsx index 099909515..1588743e8 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/onboard/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/onboard/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { ArrowLeft, ArrowRight, Bot, CheckCircle, Sparkles } from "lucide-react"; +import { ArrowLeft, ArrowRight, Bot, CheckCircle, MessageSquare, Sparkles } from "lucide-react"; import { AnimatePresence, motion } from "motion/react"; import { useParams, useRouter } from "next/navigation"; import { useTranslations } from "next-intl"; @@ -8,12 +8,13 @@ import { useEffect, useRef, useState } from "react"; import { Logo } from "@/components/Logo"; import { CompletionStep } from "@/components/onboard/completion-step"; import { SetupLLMStep } from "@/components/onboard/setup-llm-step"; +import { SetupPromptStep } from "@/components/onboard/setup-prompt-step"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Progress } from "@/components/ui/progress"; import { useGlobalLLMConfigs, useLLMConfigs, useLLMPreferences } from "@/hooks/use-llm-configs"; -const TOTAL_STEPS = 2; +const TOTAL_STEPS = 3; const OnboardPage = () => { const t = useTranslations("onboard"); @@ -95,9 +96,13 @@ const OnboardPage = () => { const progress = (currentStep / TOTAL_STEPS) * 100; - const stepTitles = [t("setup_llm_configuration"), t("setup_complete")]; + const stepTitles = [t("setup_llm_configuration"), "Configure AI Responses", t("setup_complete")]; - const stepDescriptions = [t("configure_providers_and_assign_roles"), t("all_set")]; + const stepDescriptions = [ + t("configure_providers_and_assign_roles"), + "Customize how the AI responds to your queries (Optional)", + t("all_set"), + ]; // User can proceed to step 2 if all roles are assigned const canProceedToStep2 = @@ -106,6 +111,9 @@ const OnboardPage = () => { preferences.fast_llm_id && preferences.strategic_llm_id; + // User can always proceed from step 2 to step 3 (prompt config is optional) + const canProceedToStep3 = true; + const handleNext = () => { if (currentStep < TOTAL_STEPS) { setCurrentStep(currentStep + 1); @@ -200,7 +208,8 @@ const OnboardPage = () => { {currentStep === 1 && } - {currentStep === 2 && } + {currentStep === 2 && } + {currentStep === 3 && } {stepTitles[currentStep - 1]} @@ -224,7 +233,10 @@ const OnboardPage = () => { onPreferencesUpdated={refreshPreferences} /> )} - {currentStep === 2 && } + {currentStep === 2 && ( + + )} + {currentStep === 3 && } @@ -244,11 +256,31 @@ const OnboardPage = () => { + ) : currentStep === 2 ? ( + <> + + {/* Next button is handled by SetupPromptStep component */} +
+ ) : ( - + <> + +
+ )}
diff --git a/surfsense_web/app/dashboard/[search_space_id]/settings/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/settings/page.tsx index 9eba74617..685a7baf4 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/settings/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/settings/page.tsx @@ -1,9 +1,10 @@ "use client"; -import { ArrowLeft, Bot, Brain, Settings } from "lucide-react"; +import { ArrowLeft, Bot, Brain, MessageSquare, Settings } from "lucide-react"; import { useParams, useRouter } from "next/navigation"; import { LLMRoleManager } from "@/components/settings/llm-role-manager"; import { ModelConfigManager } from "@/components/settings/model-config-manager"; +import { PromptConfigManager } from "@/components/settings/prompt-config-manager"; import { Separator } from "@/components/ui/separator"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; @@ -34,7 +35,7 @@ export default function SettingsPage() {

Settings

- Manage your LLM configurations and role assignments for this search space. + Manage your settings for this search space.

@@ -44,7 +45,7 @@ export default function SettingsPage() { {/* Settings Content */}
- + Model Configs @@ -55,6 +56,11 @@ export default function SettingsPage() { LLM Roles Roles + + + System Instructions + System Instructions +
@@ -65,6 +71,10 @@ export default function SettingsPage() { + + + +
diff --git a/surfsense_web/components/onboard/setup-llm-step.tsx b/surfsense_web/components/onboard/setup-llm-step.tsx index d0cf67055..9735061ee 100644 --- a/surfsense_web/components/onboard/setup-llm-step.tsx +++ b/surfsense_web/components/onboard/setup-llm-step.tsx @@ -624,10 +624,6 @@ export function SetupLLMStep({
-
- {t("use_cases")}: {t(role.examplesKey)} -
-