diff --git a/lightrag/utils.py b/lightrag/utils.py index c8786e7b..fd8e0adc 100644 --- a/lightrag/utils.py +++ b/lightrag/utils.py @@ -657,6 +657,10 @@ def get_conversation_turns( Returns: Formatted string of the conversation history """ + # Check if num_turns is valid + if num_turns <= 0: + return "" + # Group messages into turns turns: list[list[dict[str, Any]]] = [] messages: list[dict[str, Any]] = [] diff --git a/lightrag_webui/src/App.tsx b/lightrag_webui/src/App.tsx index 2c7e8001..1cf8c5e3 100644 --- a/lightrag_webui/src/App.tsx +++ b/lightrag_webui/src/App.tsx @@ -1,5 +1,5 @@ import { useState, useCallback } from 'react' -import ThemeProvider from '@/components/graph/ThemeProvider' +import ThemeProvider from '@/components/ThemeProvider' import MessageAlert from '@/components/MessageAlert' import ApiKeyAlert from '@/components/ApiKeyAlert' import StatusIndicator from '@/components/graph/StatusIndicator' diff --git a/lightrag_webui/src/components/graph/ThemeProvider.tsx b/lightrag_webui/src/components/ThemeProvider.tsx similarity index 100% rename from lightrag_webui/src/components/graph/ThemeProvider.tsx rename to lightrag_webui/src/components/ThemeProvider.tsx diff --git a/lightrag_webui/src/components/graph/ThemeToggle.tsx b/lightrag_webui/src/components/ThemeToggle.tsx similarity index 100% rename from lightrag_webui/src/components/graph/ThemeToggle.tsx rename to lightrag_webui/src/components/ThemeToggle.tsx diff --git a/lightrag_webui/src/features/SiteHeader.tsx b/lightrag_webui/src/features/SiteHeader.tsx index 5446e382..6eef0bb9 100644 --- a/lightrag_webui/src/features/SiteHeader.tsx +++ b/lightrag_webui/src/features/SiteHeader.tsx @@ -1,6 +1,6 @@ import Button from '@/components/ui/Button' import { SiteInfo } from '@/lib/constants' -import ThemeToggle from '@/components/graph/ThemeToggle' +import ThemeToggle from '@/components/ThemeToggle' import { TabsList, TabsTrigger } from '@/components/ui/Tabs' import { useSettingsStore } from '@/stores/settings' import { cn } from '@/lib/utils' diff --git a/lightrag_webui/src/hooks/useTheme.tsx b/lightrag_webui/src/hooks/useTheme.tsx index e1975174..5fb161a4 100644 --- a/lightrag_webui/src/hooks/useTheme.tsx +++ b/lightrag_webui/src/hooks/useTheme.tsx @@ -1,5 +1,5 @@ import { useContext } from 'react' -import { ThemeProviderContext } from '@/components/graph/ThemeProvider' +import { ThemeProviderContext } from '@/components/ThemeProvider' const useTheme = () => { const context = useContext(ThemeProviderContext) diff --git a/lightrag_webui/src/stores/settings.ts b/lightrag_webui/src/stores/settings.ts index 84f5feac..60ae8f90 100644 --- a/lightrag_webui/src/stores/settings.ts +++ b/lightrag_webui/src/stores/settings.ts @@ -5,7 +5,7 @@ import { defaultQueryLabel } from '@/lib/constants' import { Message, QueryRequest } from '@/api/lightrag' type Theme = 'dark' | 'light' | 'system' -type Tab = 'documents' | 'knowledge-graph' | 'retrieval' +type Tab = 'documents' | 'knowledge-graph' | 'retrieval' | 'api' interface SettingsState { theme: Theme