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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user