Merge branch 'release/v0.3.1' into develop

This commit is contained in:
Ke Sun
2026-04-23 12:16:57 +08:00
54 changed files with 1240 additions and 707 deletions

View File

@@ -62,7 +62,6 @@ const Agent = forwardRef<AgentRef, { onFeaturesLoad?: (features: FeaturesConfigF
const { id } = useParams();
const { message } = App.useApp()
const [form] = Form.useForm()
const [loading, setLoading] = useState(false)
const [data, setData] = useState<Config | null>(null);
const modelConfigModalRef = useRef<ModelConfigModalRef>(null)
const [modelList, setModelList] = useState<Model[]>([])
@@ -94,7 +93,6 @@ const Agent = forwardRef<AgentRef, { onFeaturesLoad?: (features: FeaturesConfigF
* Fetch agent configuration data
*/
const getData = () => {
setLoading(true)
getApplicationConfig(id as string).then(res => {
const response = res as Config
const { skills, variables } = response
@@ -127,8 +125,6 @@ const Agent = forwardRef<AgentRef, { onFeaturesLoad?: (features: FeaturesConfigF
tools: allTools
})
onFeaturesLoad?.(response.features)
}).finally(() => {
setLoading(false)
})
}
@@ -421,7 +417,6 @@ const Agent = forwardRef<AgentRef, { onFeaturesLoad?: (features: FeaturesConfigF
console.log('agent values', values)
return (
<>
{loading && <Spin fullscreen></Spin>}
<Row className="rb:h-full!" gutter={12}>
<Col span={12} className="rb:h-full!">
<Form form={form}>

View File

@@ -68,7 +68,7 @@ const Chat: FC<ChatProps> = ({
const [loading, setLoading] = useState(false)
const [isCluster, setIsCluster] = useState(source === 'multi_agent')
const [conversationId, setConversationId] = useState<string | null>(null)
const [compareLoading, setCompareLoading] = useState(false)
const compareLoadingRef = useRef(false)
const [fileList, setFileList] = useState<any[]>([])
const [message, setMessage] = useState<string | undefined>(undefined)
const [features, setFeatures] = useState<FeaturesConfigForm>({} as FeaturesConfigForm)
@@ -76,7 +76,7 @@ const Chat: FC<ChatProps> = ({
const abortRef = useRef<(() => void) | null>(null)
useEffect(() => {
setCompareLoading(false)
compareLoadingRef.current = false
setLoading(false)
return () => {
abortRef.current?.()
@@ -259,7 +259,7 @@ const Chat: FC<ChatProps> = ({
const handleSend = (msg?: string) => {
if (loading || !id) return
setLoading(true)
setCompareLoading(true)
compareLoadingRef.current = true
const files = (fileList || []).filter(item => !['uploading', 'error'].includes(item.status))
handleSave(false)
.then(() => {
@@ -285,7 +285,7 @@ const Chat: FC<ChatProps> = ({
}
if (!isCanSend) {
setLoading(false)
setCompareLoading(false)
compareLoadingRef.current = false
return
}
@@ -310,20 +310,20 @@ const Chat: FC<ChatProps> = ({
switch (item.event) {
case 'model_reasoning':
if (compareLoading) {
setCompareLoading(false)
if (compareLoadingRef.current) {
compareLoadingRef.current = false
}
updateAssistantReasoningMessage(content, model_config_id, conversation_id)
break;
case 'model_message':
if (compareLoading) {
setCompareLoading(false)
if (compareLoadingRef.current) {
compareLoadingRef.current = false
}
updateAssistantMessage(content, model_config_id, conversation_id, audio_url)
break;
case 'model_end':
if (compareLoading) {
setCompareLoading(false)
if (compareLoadingRef.current) {
compareLoadingRef.current = false
}
const idToPoll = `${model_config_id}_${audio_url}`
if (audio_url && !audioStatusMap[idToPoll]) {
@@ -365,8 +365,8 @@ const Chat: FC<ChatProps> = ({
updateErrorAssistantMessage(message_length, model_config_id)
break;
case 'compare_end':
if (compareLoading) {
setCompareLoading(false)
if (compareLoadingRef.current) {
compareLoadingRef.current = false
}
setLoading(false);
break;
@@ -401,18 +401,18 @@ const Chat: FC<ChatProps> = ({
}, handleStreamMessage, (abort) => { abortRef.current = abort })
.catch(() => {
setLoading(false)
setCompareLoading(false)
compareLoadingRef.current = false
updateClusterErrorAssistantMessage(0)
})
.finally(() => {
setLoading(false)
setCompareLoading(false)
compareLoadingRef.current = false
})
}, 0)
})
.catch(() => {
setLoading(false)
setCompareLoading(false)
compareLoadingRef.current = false
})
}
@@ -476,7 +476,7 @@ const Chat: FC<ChatProps> = ({
const handleClusterSend = (msg?: string) => {
if (loading || !id) return
setLoading(true)
setCompareLoading(true)
compareLoadingRef.current = true
const files = (fileList || []).filter(item => !['uploading', 'error'].includes(item.status))
handleSave(false)
.then(() => {
@@ -500,8 +500,8 @@ const Chat: FC<ChatProps> = ({
}
break
case 'message':
if (compareLoading) {
setCompareLoading(false)
if (compareLoadingRef.current) {
compareLoadingRef.current = false
}
updateClusterAssistantMessage(content)
if (conversation_id && conversationId !== conversation_id) {
@@ -509,14 +509,14 @@ const Chat: FC<ChatProps> = ({
}
break;
case 'model_end':
if (compareLoading) {
setCompareLoading(false)
if (compareLoadingRef.current) {
compareLoadingRef.current = false
}
updateClusterErrorAssistantMessage(message_length)
break;
case 'compare_end':
if (compareLoading) {
setCompareLoading(false)
if (compareLoadingRef.current) {
compareLoadingRef.current = false
}
setLoading(false);
break;
@@ -547,18 +547,18 @@ const Chat: FC<ChatProps> = ({
)
.catch(() => {
setLoading(false)
setCompareLoading(false)
compareLoadingRef.current = false
updateClusterErrorAssistantMessage(0)
})
.finally(() => {
setLoading(false)
setCompareLoading(false)
compareLoadingRef.current = false
})
}, 0)
})
.catch(() => {
setLoading(false)
setCompareLoading(false)
compareLoadingRef.current = false
})
}
@@ -628,7 +628,7 @@ const Chat: FC<ChatProps> = ({
/>}
onSend={isCluster ? handleClusterSend : handleSend}
data={chat.list || []}
streamLoading={compareLoading}
streamLoading={compareLoadingRef.current}
labelPosition="top"
labelFormat={(item) => item.role === 'user' ? t('application.you') : chat.label || t(`application.ai`)}
errorDesc={t('application.ReplyException')}

View File

@@ -2,7 +2,7 @@
* @Author: ZhaoYing
* @Date: 2026-02-03 16:25:32
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-03-04 10:34:43
* @Last Modified time: 2026-04-21 13:34:52
*/
/**
* Knowledge Base Component
@@ -54,7 +54,7 @@ const Knowledge: FC<{value?: KnowledgeConfig; onChange?: (config: KnowledgeConfi
const basesWithoutName = knowledge_bases.filter(base => !base.name)
if (basesWithoutName.length > 0) {
// Call API to get complete knowledge base information
getKnowledgeBaseList().then(res => {
getKnowledgeBaseList(undefined, { kb_ids: basesWithoutName.map(vo => vo.kb_id).join(',') }).then(res => {
const fullBases = knowledge_bases.map(base => {
if (!base.name) {
const fullBase = res.items.find((item: any) => item.id === base.kb_id)