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() {
|
||||
const { t } = useTranslation()
|
||||
const [messages, setMessages] = useState<MessageWithError[]>(() => {
|
||||
const history = useSettingsStore.getState().retrievalHistory || []
|
||||
// Ensure each message from history has a unique ID and mermaidRendered status
|
||||
return history.map((msg, index) => {
|
||||
const msgWithError = msg as MessageWithError // Cast to access potential properties
|
||||
return {
|
||||
...msg,
|
||||
id: msgWithError.id || `hist-${Date.now()}-${index}`, // Add ID if missing
|
||||
mermaidRendered: msgWithError.mermaidRendered ?? true // Assume historical mermaid is rendered
|
||||
}
|
||||
})
|
||||
try {
|
||||
const history = useSettingsStore.getState().retrievalHistory || []
|
||||
// Ensure each message from history has a unique ID and mermaidRendered status
|
||||
return history.map((msg, index) => {
|
||||
try {
|
||||
const msgWithError = msg as MessageWithError // Cast to access potential properties
|
||||
return {
|
||||
...msg,
|
||||
id: msgWithError.id || `hist-${Date.now()}-${index}`, // Add ID if missing
|
||||
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 [isLoading, setIsLoading] = useState(false)
|
||||
|
@@ -167,7 +167,7 @@ const useSettingsStoreBase = create<SettingsState>()(
|
||||
{
|
||||
name: 'settings-storage',
|
||||
storage: createJSONStorage(() => localStorage),
|
||||
version: 11,
|
||||
version: 12,
|
||||
migrate: (state: any, version: number) => {
|
||||
if (version < 2) {
|
||||
state.showEdgeLabel = false
|
||||
@@ -221,6 +221,10 @@ const useSettingsStoreBase = create<SettingsState>()(
|
||||
state.minEdgeSize = 1
|
||||
state.maxEdgeSize = 1
|
||||
}
|
||||
if (version < 12) {
|
||||
// Clear retrieval history to avoid compatibility issues with MessageWithError type
|
||||
state.retrievalHistory = []
|
||||
}
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user