refactor(iod): 重构数联网相关组件和逻辑
-优化了 Data、Scene 和 Team组件的逻辑,使用 currentIodMessage 替代复杂的条件判断- 改进了 IodRelevant 组件的动画和数据处理方式 - 调整了 Message 组件以支持数联网搜索功能 - 重构了 PlaygroundIodProvider,简化了上下文类型和数据处理 - 更新了数据库相关操作,使用新的 HistoryMessage 类型 - 新增了 IodDb 类来管理数联网连接配置
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
} from "@/db"
|
||||
import { exportKnowledge, importKnowledge } from "@/db/knowledge"
|
||||
import { exportVectors, importVectors } from "@/db/vector"
|
||||
import { IodDb } from "@/db/iod"
|
||||
import { message } from "antd"
|
||||
|
||||
export const exportPageAssistData = async () => {
|
||||
@@ -13,12 +14,14 @@ export const exportPageAssistData = async () => {
|
||||
const chat = await exportChatHistory()
|
||||
const vector = await exportVectors()
|
||||
const prompts = await exportPrompts()
|
||||
const iod = IodDb.getInstance().getIodConfig()
|
||||
|
||||
const data = {
|
||||
knowledge,
|
||||
chat,
|
||||
vector,
|
||||
prompts
|
||||
prompts,
|
||||
iod
|
||||
}
|
||||
|
||||
const dataStr = JSON.stringify(data)
|
||||
@@ -34,6 +37,7 @@ export const exportPageAssistData = async () => {
|
||||
}
|
||||
|
||||
export const importPageAssistData = async (file: File) => {
|
||||
debugger
|
||||
const reader = new FileReader()
|
||||
reader.onload = async () => {
|
||||
try {
|
||||
@@ -55,6 +59,10 @@ export const importPageAssistData = async (file: File) => {
|
||||
await importPrompts(data.prompts)
|
||||
}
|
||||
|
||||
if(data?.iod) {
|
||||
IodDb.getInstance().insertIodConnection(data.iod)
|
||||
}
|
||||
|
||||
message.success("Data imported successfully")
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
|
||||
Reference in New Issue
Block a user