Bump webui setting version to 12
This commit is contained in:
@@ -15,16 +15,33 @@ import type { QueryMode } from '@/api/lightrag'
|
|||||||
export default function RetrievalTesting() {
|
export default function RetrievalTesting() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [messages, setMessages] = useState<MessageWithError[]>(() => {
|
const [messages, setMessages] = useState<MessageWithError[]>(() => {
|
||||||
|
try {
|
||||||
const history = useSettingsStore.getState().retrievalHistory || []
|
const history = useSettingsStore.getState().retrievalHistory || []
|
||||||
// Ensure each message from history has a unique ID and mermaidRendered status
|
// Ensure each message from history has a unique ID and mermaidRendered status
|
||||||
return history.map((msg, index) => {
|
return history.map((msg, index) => {
|
||||||
|
try {
|
||||||
const msgWithError = msg as MessageWithError // Cast to access potential properties
|
const msgWithError = msg as MessageWithError // Cast to access potential properties
|
||||||
return {
|
return {
|
||||||
...msg,
|
...msg,
|
||||||
id: msgWithError.id || `hist-${Date.now()}-${index}`, // Add ID if missing
|
id: msgWithError.id || `hist-${Date.now()}-${index}`, // Add ID if missing
|
||||||
mermaidRendered: msgWithError.mermaidRendered ?? true // Assume historical mermaid is rendered
|
mermaidRendered: msgWithError.mermaidRendered ?? true // Assume historical mermaid is rendered
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error processing message:', error)
|
||||||
|
// Return a default message if there's an error
|
||||||
|
return {
|
||||||
|
role: 'system',
|
||||||
|
content: 'Error loading message',
|
||||||
|
id: `error-${Date.now()}-${index}`,
|
||||||
|
isError: true,
|
||||||
|
mermaidRendered: true
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error loading history:', error)
|
||||||
|
return [] // Return an empty array if there's an error
|
||||||
|
}
|
||||||
})
|
})
|
||||||
const [inputValue, setInputValue] = useState('')
|
const [inputValue, setInputValue] = useState('')
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
@@ -167,7 +167,7 @@ const useSettingsStoreBase = create<SettingsState>()(
|
|||||||
{
|
{
|
||||||
name: 'settings-storage',
|
name: 'settings-storage',
|
||||||
storage: createJSONStorage(() => localStorage),
|
storage: createJSONStorage(() => localStorage),
|
||||||
version: 11,
|
version: 12,
|
||||||
migrate: (state: any, version: number) => {
|
migrate: (state: any, version: number) => {
|
||||||
if (version < 2) {
|
if (version < 2) {
|
||||||
state.showEdgeLabel = false
|
state.showEdgeLabel = false
|
||||||
@@ -221,6 +221,10 @@ const useSettingsStoreBase = create<SettingsState>()(
|
|||||||
state.minEdgeSize = 1
|
state.minEdgeSize = 1
|
||||||
state.maxEdgeSize = 1
|
state.maxEdgeSize = 1
|
||||||
}
|
}
|
||||||
|
if (version < 12) {
|
||||||
|
// Clear retrieval history to avoid compatibility issues with MessageWithError type
|
||||||
|
state.retrievalHistory = []
|
||||||
|
}
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user