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 getModels = () => {
|
||||||
const requests = [getModelList({ type: 'llm', pagesize: 100, page: 1 }), getModelList({ type: 'chat', pagesize: 100, page: 1 })]
|
getModelList({ type: 'llm,chat', pagesize: 100, page: 1 })
|
||||||
Promise.all(requests)
|
.then(res => {
|
||||||
.then(responses => {
|
const response = res as { items: Model[] }
|
||||||
const [chatRes, modelRes] = responses as { items: Model[] }[]
|
setModelList(response.items)
|
||||||
const chatList = chatRes.items || []
|
|
||||||
const modelList = modelRes.items || []
|
|
||||||
setModelList([...chatList, ...modelList])
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const handleAddModel = () => {
|
const handleAddModel = () => {
|
||||||
|
|||||||
@@ -54,13 +54,10 @@ const MemoryExtractionEngine: FC = () => {
|
|||||||
}, [values])
|
}, [values])
|
||||||
|
|
||||||
const getModels = () => {
|
const getModels = () => {
|
||||||
const requests = [getModelList({ type: 'llm', pagesize: 100, page: 1 }), getModelList({ type: 'chat', pagesize: 100, page: 1 })]
|
getModelList({ type: 'llm,chat', pagesize: 100, page: 1 })
|
||||||
Promise.all(requests)
|
.then(res => {
|
||||||
.then(responses => {
|
const response = res as { items: Model[] }
|
||||||
const [chatRes, modelRes] = responses as { items: Model[] }[]
|
setModelList(response.items)
|
||||||
const chatList = chatRes.items || []
|
|
||||||
const modelList = modelRes.items || []
|
|
||||||
setModelList([...chatList, ...modelList])
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,13 +80,10 @@ const SpaceModal = forwardRef<SpaceModalRef, SpaceModalProps>(({
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const getModels = () => {
|
const getModels = () => {
|
||||||
const requests = [getModelList({ type: 'llm', pagesize: 100, page: 1 }), getModelList({ type: 'chat', pagesize: 100, page: 1 })]
|
getModelList({ type: 'llm,chat', pagesize: 100, page: 1 })
|
||||||
Promise.all(requests)
|
.then(res => {
|
||||||
.then(responses => {
|
const response = res as { items: Model[] }
|
||||||
const [chatRes, modelRes] = responses as { items: Model[] }[]
|
setModelList(response.items)
|
||||||
const chatList = chatRes.items || []
|
|
||||||
const modelList = modelRes.items || []
|
|
||||||
setModelList([...chatList, ...modelList])
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import type { ToolItem, Query, CustomToolModalRef } from './types';
|
|||||||
import CustomToolModal from './components/CustomToolModal';
|
import CustomToolModal from './components/CustomToolModal';
|
||||||
import SearchInput from '@/components/SearchInput'
|
import SearchInput from '@/components/SearchInput'
|
||||||
import BodyWrapper from '@/components/Empty/BodyWrapper'
|
import BodyWrapper from '@/components/Empty/BodyWrapper'
|
||||||
import RbCard from '@/components/RbCard'
|
import RbCard from '@/components/RbCard/Card'
|
||||||
import { getTools, deleteTool } from '@/api/tools'
|
import { getTools, deleteTool } from '@/api/tools'
|
||||||
|
|
||||||
const Custom: React.FC<{ getStatusTag: (status: string) => ReactNode }> = ({ getStatusTag }) => {
|
const Custom: React.FC<{ getStatusTag: (status: string) => ReactNode }> = ({ getStatusTag }) => {
|
||||||
|
|||||||
@@ -97,12 +97,6 @@ const JsonToolModal = forwardRef<JsonToolModalRef>((_props, ref) => {
|
|||||||
case 'minify':
|
case 'minify':
|
||||||
setFormatValue(data.minified_json)
|
setFormatValue(data.minified_json)
|
||||||
break
|
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">
|
<Space size={8} className="rb:mb-3">
|
||||||
<Button onClick={() => handleOperate('format')}>{t('tool.format')}</Button>
|
<Button onClick={() => handleOperate('format')}>{t('tool.format')}</Button>
|
||||||
<Button onClick={() => handleOperate('minify')}>{t('tool.minify')}</Button>
|
<Button onClick={() => handleOperate('minify')}>{t('tool.minify')}</Button>
|
||||||
<Button onClick={() => handleOperate('validate')}>{t('tool.validate')}</Button>
|
|
||||||
</Space>
|
</Space>
|
||||||
<FormItem
|
<FormItem
|
||||||
label={t('tool.outputResult')}
|
label={t('tool.outputResult')}
|
||||||
>
|
>
|
||||||
{typeof formatValue === "string" && formatValue
|
{typeof formatValue === "string" && formatValue
|
||||||
? <CodeBlock value={formatValue} />
|
? <CodeBlock value={formatValue} />
|
||||||
: formatValue && typeof formatValue === "object"
|
: <div className="rb:bg-[#F0F3F8] rb:text-[12px] rb:p-[16px_20px_16px_24px] rb:rounded-lg rb:text-[#A8A9AA]">{t('tool.noResult')}</div>
|
||||||
? <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>
|
|
||||||
}
|
}
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
@@ -25,9 +25,17 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, suggesti
|
|||||||
|
|
||||||
parts.forEach(part => {
|
parts.forEach(part => {
|
||||||
const match = part.match(/^\{\{([^.]+)\.([^}]+)\}\}$/);
|
const match = part.match(/^\{\{([^.]+)\.([^}]+)\}\}$/);
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
const [, nodeId, label] = match;
|
const [_, nodeId, label] = match;
|
||||||
const suggestion = suggestions.find(s => s.nodeData.id === nodeId && s.label === label);
|
|
||||||
|
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) {
|
if (suggestion) {
|
||||||
paragraph.append($createVariableNode(suggestion));
|
paragraph.append($createVariableNode(suggestion));
|
||||||
} else {
|
} else {
|
||||||
@@ -43,7 +51,7 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, suggesti
|
|||||||
|
|
||||||
initializedRef.current = true;
|
initializedRef.current = true;
|
||||||
}
|
}
|
||||||
}, []);
|
}, [suggestions]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user