fix(web): update get llm,chat model list function
This commit is contained in:
@@ -308,13 +308,10 @@ const Agent = forwardRef<AgentRef>((_props, ref) => {
|
||||
})
|
||||
}
|
||||
const getModels = () => {
|
||||
const requests = [getModelList({ type: 'llm', pagesize: 100, page: 1 }), getModelList({ type: 'chat', pagesize: 100, page: 1 })]
|
||||
Promise.all(requests)
|
||||
.then(responses => {
|
||||
const [chatRes, modelRes] = responses as { items: Model[] }[]
|
||||
const chatList = chatRes.items || []
|
||||
const modelList = modelRes.items || []
|
||||
setModelList([...chatList, ...modelList])
|
||||
getModelList({ type: 'llm,chat', pagesize: 100, page: 1 })
|
||||
.then(res => {
|
||||
const response = res as { items: Model[] }
|
||||
setModelList(response.items)
|
||||
})
|
||||
}
|
||||
const handleAddModel = () => {
|
||||
|
||||
@@ -54,13 +54,10 @@ const MemoryExtractionEngine: FC = () => {
|
||||
}, [values])
|
||||
|
||||
const getModels = () => {
|
||||
const requests = [getModelList({ type: 'llm', pagesize: 100, page: 1 }), getModelList({ type: 'chat', pagesize: 100, page: 1 })]
|
||||
Promise.all(requests)
|
||||
.then(responses => {
|
||||
const [chatRes, modelRes] = responses as { items: Model[] }[]
|
||||
const chatList = chatRes.items || []
|
||||
const modelList = modelRes.items || []
|
||||
setModelList([...chatList, ...modelList])
|
||||
getModelList({ type: 'llm,chat', pagesize: 100, page: 1 })
|
||||
.then(res => {
|
||||
const response = res as { items: Model[] }
|
||||
setModelList(response.items)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -80,13 +80,10 @@ const SpaceModal = forwardRef<SpaceModalRef, SpaceModalProps>(({
|
||||
}, [])
|
||||
|
||||
const getModels = () => {
|
||||
const requests = [getModelList({ type: 'llm', pagesize: 100, page: 1 }), getModelList({ type: 'chat', pagesize: 100, page: 1 })]
|
||||
Promise.all(requests)
|
||||
.then(responses => {
|
||||
const [chatRes, modelRes] = responses as { items: Model[] }[]
|
||||
const chatList = chatRes.items || []
|
||||
const modelList = modelRes.items || []
|
||||
setModelList([...chatList, ...modelList])
|
||||
getModelList({ type: 'llm,chat', pagesize: 100, page: 1 })
|
||||
.then(res => {
|
||||
const response = res as { items: Model[] }
|
||||
setModelList(response.items)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { ToolItem, Query, CustomToolModalRef } from './types';
|
||||
import CustomToolModal from './components/CustomToolModal';
|
||||
import SearchInput from '@/components/SearchInput'
|
||||
import BodyWrapper from '@/components/Empty/BodyWrapper'
|
||||
import RbCard from '@/components/RbCard'
|
||||
import RbCard from '@/components/RbCard/Card'
|
||||
import { getTools, deleteTool } from '@/api/tools'
|
||||
|
||||
const Custom: React.FC<{ getStatusTag: (status: string) => ReactNode }> = ({ getStatusTag }) => {
|
||||
|
||||
@@ -25,9 +25,17 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, suggesti
|
||||
|
||||
parts.forEach(part => {
|
||||
const match = part.match(/^\{\{([^.]+)\.([^}]+)\}\}$/);
|
||||
|
||||
if (match) {
|
||||
const [, nodeId, label] = match;
|
||||
const suggestion = suggestions.find(s => s.nodeData.id === nodeId && s.label === label);
|
||||
const [_, nodeId, label] = match;
|
||||
|
||||
const suggestion = suggestions.find(s => {
|
||||
if (nodeId === 'sys') {
|
||||
return s.nodeData.type === 'start' && s.label === `sys.${label}`
|
||||
}
|
||||
return s.nodeData.id === nodeId && s.label === label
|
||||
});
|
||||
|
||||
if (suggestion) {
|
||||
paragraph.append($createVariableNode(suggestion));
|
||||
} else {
|
||||
@@ -43,7 +51,7 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, suggesti
|
||||
|
||||
initializedRef.current = true;
|
||||
}
|
||||
}, []);
|
||||
}, [suggestions]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user