feat: complete Day 21-24 knowledge base features

- Day 21-22: fix CORS and file upload issues
- Day 23-24: implement @knowledge base search and conversation integration
- Backend: integrate Dify RAG into conversation system
- Frontend: load knowledge base list and @ reference feature
This commit is contained in:
AI Clinical Dev Team
2025-10-11 17:08:12 +08:00
parent 239c7ea85e
commit 60014b57b5
5 changed files with 218 additions and 18 deletions

View File

@@ -8,10 +8,12 @@ import MessageList from '../components/chat/MessageList'
import MessageInput from '../components/chat/MessageInput'
import ModelSelector, { type ModelType } from '../components/chat/ModelSelector'
import { useProjectStore } from '../stores/useProjectStore'
import { useKnowledgeBaseStore } from '../stores/useKnowledgeBaseStore'
const AgentChatPage = () => {
const { agentId } = useParams()
const { currentProject } = useProjectStore()
const { knowledgeBases, fetchKnowledgeBases } = useKnowledgeBaseStore()
// 智能体相关状态
const [agent, setAgent] = useState<AgentConfig | null>(null)
@@ -26,9 +28,6 @@ const AgentChatPage = () => {
// 消息发送状态
const [sending, setSending] = useState(false)
const [streamingContent, setStreamingContent] = useState('')
// 知识库(预留)
const [knowledgeBases] = useState([])
// 加载智能体配置
useEffect(() => {
@@ -56,6 +55,11 @@ const AgentChatPage = () => {
fetchAgent()
}, [agentId])
// 加载知识库列表
useEffect(() => {
fetchKnowledgeBases()
}, [])
// 创建或加载对话
useEffect(() => {
const initConversation = async () => {
@@ -267,4 +271,3 @@ const AgentChatPage = () => {
}
export default AgentChatPage