ArnoChen commited on
Commit
2e0d004
·
1 Parent(s): a59011e

add api tab in webui and handle invalid num_turns

Browse files
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/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