Merge #70 into develop_web from feature/20251219_zy
fix(web): update get llm,chat model list function * feature/20251219_zy: (2 commits) feat(web): JSON Tool update fix(web): update get llm,chat model list function Signed-off-by: zhaoying <zhaoying@redbearai.com> Merged-by: zhaoying <zhaoying@redbearai.com> CR-link: https://codeup.aliyun.com/redbearai/python/redbear-mem-open/change/70
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 }) => {
|
||||
|
||||
@@ -97,12 +97,6 @@ const JsonToolModal = forwardRef<JsonToolModalRef>((_props, ref) => {
|
||||
case 'minify':
|
||||
setFormatValue(data.minified_json)
|
||||
break
|
||||
case 'validate':
|
||||
setFormatValue(data.structure)
|
||||
break
|
||||
case 'convert':
|
||||
setFormatValue(data.converted_json)
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -141,16 +135,13 @@ const JsonToolModal = forwardRef<JsonToolModalRef>((_props, ref) => {
|
||||
<Space size={8} className="rb:mb-3">
|
||||
<Button onClick={() => handleOperate('format')}>{t('tool.format')}</Button>
|
||||
<Button onClick={() => handleOperate('minify')}>{t('tool.minify')}</Button>
|
||||
<Button onClick={() => handleOperate('validate')}>{t('tool.validate')}</Button>
|
||||
</Space>
|
||||
<FormItem
|
||||
label={t('tool.outputResult')}
|
||||
>
|
||||
{typeof formatValue === "string" && formatValue
|
||||
? <CodeBlock value={formatValue} />
|
||||
: formatValue && typeof formatValue === "object"
|
||||
? <div className="rb:bg-[#F0F3F8] rb:p-[16px_20px_16px_24px] rb:rounded-lg"><Tree showLine treeData={convertToTreeData(formatValue)} /></div>
|
||||
: <div className="rb:bg-[#F0F3F8] rb:p-[16px_20px_16px_24px] rb:rounded-lg rb:text-[#A8A9AA]">{t('tool.noResult')}</div>
|
||||
: <div className="rb:bg-[#F0F3F8] rb:text-[12px] rb:p-[16px_20px_16px_24px] rb:rounded-lg rb:text-[#A8A9AA]">{t('tool.noResult')}</div>
|
||||
}
|
||||
</FormItem>
|
||||
</Form>
|
||||
|
||||
@@ -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