diff --git a/app/backend/main.py b/app/backend/main.py index 76944324..4b3724e5 100644 --- a/app/backend/main.py +++ b/app/backend/main.py @@ -82,7 +82,6 @@ async def stream_chat(request: Request) -> Response: # Restore session state from incoming AG-UI state (look under namespaced key) initial_qa_history: list[QAResponse] = [] - background_context: str | None = None session_id: str | None = None state = getattr(run_input, "state", None) if state: @@ -91,7 +90,6 @@ async def stream_chat(request: Request) -> Response: initial_qa_history = [ QAResponse(**qa) for qa in chat_state.get("qa_history", []) ] - background_context = chat_state.get("background_context") session_id = chat_state.get("session_id") # Determine session_id: prefer state, fall back to thread_id, generate UUID if neither @@ -105,8 +103,6 @@ async def stream_chat(request: Request) -> Response: session_state=ChatSessionState( session_id=session_id, qa_history=initial_qa_history, - background_context=background_context, - # session_context intentionally NOT set - agent will fetch from cache ), state_key=AGUI_STATE_KEY, ) diff --git a/app/frontend/components/Chat.tsx b/app/frontend/components/Chat.tsx index 317394f5..247ce0f5 100644 --- a/app/frontend/components/Chat.tsx +++ b/app/frontend/components/Chat.tsx @@ -7,12 +7,11 @@ import { useCopilotAction, } from "@copilotkit/react-core"; import { CopilotChat } from "@copilotkit/react-ui"; -import { useCallback, useEffect, useState } from "react"; +import { useState } from "react"; import "@copilotkit/react-ui/styles.css"; import CitationBlock from "./CitationBlock"; import ContextPanel from "./ContextPanel"; import DbInfo from "./DbInfo"; -import SettingsPanel, { STORAGE_KEY } from "./SettingsPanel"; // Must match AGUI_STATE_KEY from haiku.rag.agents.chat const AGUI_STATE_KEY = "haiku.rag.chat"; @@ -44,7 +43,6 @@ interface ChatSessionState { session_id: string; citations: Citation[]; qa_history: QAResponse[]; - background_context: string | null; session_context: SessionContext | null; } @@ -141,24 +139,6 @@ function FileIcon() { ); } -function SettingsIcon() { - return ( - - - - - ); -} - function BrainIcon() { return ( void; -}) { - const [settingsOpen, setSettingsOpen] = useState(false); +function ChatContentInner() { const [contextOpen, setContextOpen] = useState(false); - const handleSaveContext = useCallback( - (value: string) => { - setBackgroundContext(value); - if (value) { - localStorage.setItem(STORAGE_KEY, value); - } else { - localStorage.removeItem(STORAGE_KEY); - } - }, - [setBackgroundContext], - ); - const { state: agentState } = useCoAgent({ name: "chat_agent", initialState: { @@ -418,7 +379,6 @@ function ChatContentInner({ session_id: "", citations: [], qa_history: [], - background_context: backgroundContext || null, session_context: null, }, }, @@ -566,19 +526,6 @@ function ChatContentInner({ Memory -
- setSettingsOpen(false)} - onSave={handleSaveContext} - currentValue={backgroundContext} - /> setContextOpen(false)} @@ -608,25 +549,7 @@ function ChatContentInner({ } function ChatContent() { - const [backgroundContext, setBackgroundContext] = useState( - null, - ); - - useEffect(() => { - const stored = localStorage.getItem(STORAGE_KEY); - setBackgroundContext(stored || ""); - }, []); - - if (backgroundContext === null) { - return null; - } - - return ( - - ); + return ; } export default function Chat() { diff --git a/app/frontend/components/SettingsPanel.tsx b/app/frontend/components/SettingsPanel.tsx deleted file mode 100644 index 0e3c53ed..00000000 --- a/app/frontend/components/SettingsPanel.tsx +++ /dev/null @@ -1,188 +0,0 @@ -"use client"; - -import { useCallback, useEffect, useId, useState } from "react"; - -const STORAGE_KEY = "haiku.rag.settings.background_context"; - -interface SettingsPanelProps { - isOpen: boolean; - onClose: () => void; - onSave: (backgroundContext: string) => void; - currentValue: string; -} - -export default function SettingsPanel({ - isOpen, - onClose, - onSave, - currentValue, -}: SettingsPanelProps) { - const [value, setValue] = useState(currentValue); - const titleId = useId(); - - useEffect(() => { - if (isOpen) { - setValue(currentValue); - } - }, [isOpen, currentValue]); - - const handleSave = useCallback(() => { - onSave(value); - onClose(); - }, [value, onSave, onClose]); - - const handleKeyDown = useCallback( - (e: React.KeyboardEvent) => { - if (e.key === "Escape") { - onClose(); - } - }, - [onClose], - ); - - if (!isOpen) { - return null; - } - - return ( - <> - -
- {/* biome-ignore lint/a11y/noStaticElementInteractions: modal content wrapper */} -
e.stopPropagation()} - onKeyDown={(e) => e.stopPropagation()} - > -

- Background Context -

-

- Provide background information that will be used throughout your - conversation. This helps the assistant understand domain-specific - context, terminology, or any relevant details about your questions. -

-