Merge pull request #800 from ArnoChenFx/misc
Browse filesFix: Correct component paths, add 'api' tab, and handle invalid num_turns
- lightrag/utils.py +4 -0
- lightrag_webui/src/App.tsx +1 -1
- lightrag_webui/src/components/{graph/ThemeProvider.tsx β ThemeProvider.tsx} +0 -0
- lightrag_webui/src/components/{graph/ThemeToggle.tsx β ThemeToggle.tsx} +0 -0
- lightrag_webui/src/features/SiteHeader.tsx +1 -1
- lightrag_webui/src/hooks/useTheme.tsx +1 -1
- lightrag_webui/src/stores/settings.ts +1 -1
lightrag/utils.py
CHANGED
@@ -657,6 +657,10 @@ def get_conversation_turns(
|
|
657 |
Returns:
|
658 |
Formatted string of the conversation history
|
659 |
"""
|
|
|
|
|
|
|
|
|
660 |
# Group messages into turns
|
661 |
turns: list[list[dict[str, Any]]] = []
|
662 |
messages: list[dict[str, Any]] = []
|
|
|
657 |
Returns:
|
658 |
Formatted string of the conversation history
|
659 |
"""
|
660 |
+
# Check if num_turns is valid
|
661 |
+
if num_turns <= 0:
|
662 |
+
return ""
|
663 |
+
|
664 |
# Group messages into turns
|
665 |
turns: list[list[dict[str, Any]]] = []
|
666 |
messages: list[dict[str, Any]] = []
|
lightrag_webui/src/App.tsx
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import { useState, useCallback } from 'react'
|
2 |
-
import ThemeProvider from '@/components/
|
3 |
import MessageAlert from '@/components/MessageAlert'
|
4 |
import ApiKeyAlert from '@/components/ApiKeyAlert'
|
5 |
import StatusIndicator from '@/components/graph/StatusIndicator'
|
|
|
1 |
import { useState, useCallback } from 'react'
|
2 |
+
import ThemeProvider from '@/components/ThemeProvider'
|
3 |
import MessageAlert from '@/components/MessageAlert'
|
4 |
import ApiKeyAlert from '@/components/ApiKeyAlert'
|
5 |
import StatusIndicator from '@/components/graph/StatusIndicator'
|
lightrag_webui/src/components/{graph/ThemeProvider.tsx β ThemeProvider.tsx}
RENAMED
File without changes
|
lightrag_webui/src/components/{graph/ThemeToggle.tsx β ThemeToggle.tsx}
RENAMED
File without changes
|
lightrag_webui/src/features/SiteHeader.tsx
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import Button from '@/components/ui/Button'
|
2 |
import { SiteInfo } from '@/lib/constants'
|
3 |
-
import ThemeToggle from '@/components/
|
4 |
import { TabsList, TabsTrigger } from '@/components/ui/Tabs'
|
5 |
import { useSettingsStore } from '@/stores/settings'
|
6 |
import { cn } from '@/lib/utils'
|
|
|
1 |
import Button from '@/components/ui/Button'
|
2 |
import { SiteInfo } from '@/lib/constants'
|
3 |
+
import ThemeToggle from '@/components/ThemeToggle'
|
4 |
import { TabsList, TabsTrigger } from '@/components/ui/Tabs'
|
5 |
import { useSettingsStore } from '@/stores/settings'
|
6 |
import { cn } from '@/lib/utils'
|
lightrag_webui/src/hooks/useTheme.tsx
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import { useContext } from 'react'
|
2 |
-
import { ThemeProviderContext } from '@/components/
|
3 |
|
4 |
const useTheme = () => {
|
5 |
const context = useContext(ThemeProviderContext)
|
|
|
1 |
import { useContext } from 'react'
|
2 |
+
import { ThemeProviderContext } from '@/components/ThemeProvider'
|
3 |
|
4 |
const useTheme = () => {
|
5 |
const context = useContext(ThemeProviderContext)
|
lightrag_webui/src/stores/settings.ts
CHANGED
@@ -5,7 +5,7 @@ import { defaultQueryLabel } from '@/lib/constants'
|
|
5 |
import { Message, QueryRequest } from '@/api/lightrag'
|
6 |
|
7 |
type Theme = 'dark' | 'light' | 'system'
|
8 |
-
type Tab = 'documents' | 'knowledge-graph' | 'retrieval'
|
9 |
|
10 |
interface SettingsState {
|
11 |
theme: Theme
|
|
|
5 |
import { Message, QueryRequest } from '@/api/lightrag'
|
6 |
|
7 |
type Theme = 'dark' | 'light' | 'system'
|
8 |
+
type Tab = 'documents' | 'knowledge-graph' | 'retrieval' | 'api'
|
9 |
|
10 |
interface SettingsState {
|
11 |
theme: Theme
|