mirror of
https://github.com/2930134478/AI-CS.git
synced 2026-06-15 00:44:30 +08:00
知识库及UI更新
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
|
||||
### 方式一:预构建镜像一键部署(推荐,最简单)⭐
|
||||
|
||||
> **最简单快捷的方式**,直接使用预构建的 Docker 镜像,无需构建,一行命令启动。
|
||||
> **最简单快捷的方式**,直接使用预构建的 Docker 镜像,无需构建,一行命令启动
|
||||
|
||||
#### 前置要求
|
||||
|
||||
|
||||
+10
-10
@@ -6,14 +6,14 @@ import (
|
||||
|
||||
// Document 文档模型
|
||||
type Document struct {
|
||||
ID uint `json:"id" gorm:"primarykey"`
|
||||
KnowledgeBaseID uint `json:"knowledge_base_id" gorm:"index;not null"`
|
||||
Title string `json:"title" gorm:"type:varchar(255);not null"`
|
||||
Content string `json:"content" gorm:"type:text;not null"`
|
||||
Summary string `json:"summary" gorm:"type:text"` // 摘要
|
||||
Type string `json:"type" gorm:"type:varchar(50);default:'document'"` // 文档类型:document, url, file
|
||||
Status string `json:"status" gorm:"type:varchar(20);default:'draft'"` // 状态:draft(草稿)、published(已发布)
|
||||
EmbeddingStatus string `json:"embedding_status" gorm:"type:varchar(20);default:'pending'"` // 向量化状态:pending(待处理)、processing(处理中)、completed(已完成)、failed(失败)
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ID uint `json:"id" gorm:"primarykey"`
|
||||
KnowledgeBaseID uint `json:"knowledge_base_id" gorm:"index;not null"`
|
||||
Title string `json:"title" gorm:"type:varchar(255);not null"`
|
||||
Content string `json:"content" gorm:"type:text;not null"`
|
||||
Summary string `json:"summary" gorm:"type:text"` // 摘要
|
||||
Type string `json:"type" gorm:"type:varchar(50);default:'document'"` // 文档类型:document, url, file
|
||||
Status string `json:"status" gorm:"type:varchar(20);default:'draft'"` // 状态:draft(草稿)、published(已发布)
|
||||
EmbeddingStatus string `json:"embedding_status" gorm:"type:varchar(20);default:'pending'"` // 向量化状态:pending(待处理)、processing(处理中)、completed(已完成)、failed(失败)
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { playNotificationSound } from "@/utils/sound";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
|
||||
export function useSoundNotification(enabled: boolean = true) {
|
||||
export function useSoundNotification(initialEnabled: boolean = true) {
|
||||
const [enabled, setEnabled] = useState(initialEnabled);
|
||||
const audioRef = useRef<HTMLAudioElement | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -20,13 +20,17 @@ export function useSoundNotification(enabled: boolean = true) {
|
||||
};
|
||||
}, [enabled]);
|
||||
|
||||
const play = () => {
|
||||
const play = useCallback(() => {
|
||||
if (enabled && audioRef.current) {
|
||||
audioRef.current.play().catch(() => {
|
||||
// 忽略播放错误
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [enabled]);
|
||||
|
||||
return { play };
|
||||
const toggle = useCallback(() => {
|
||||
setEnabled((prev) => !prev);
|
||||
}, []);
|
||||
|
||||
return { enabled, toggle, play };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user