Merge branch 'feat/dev-0.6' of https://github.com/eosphoros-ai/DB-GPT into feat/dev-0.6

This commit is contained in:
yhjun1026
2024-08-14 10:44:24 +08:00
2 changed files with 16 additions and 6 deletions

View File

@@ -153,9 +153,11 @@ const ChatSider: React.FC<{
listLoading: boolean; listLoading: boolean;
order: React.MutableRefObject<number>; order: React.MutableRefObject<number>;
}> = ({ dialogueList = [], refresh, historyLoading, listLoading, order }) => { }> = ({ dialogueList = [], refresh, historyLoading, listLoading, order }) => {
const searchParams = useSearchParams();
const scene = searchParams?.get('scene') ?? '';
const { t } = useTranslation(); const { t } = useTranslation();
const { mode } = useContext(ChatContext); const { mode } = useContext(ChatContext);
const [collapsed, setCollapsed] = useState<boolean>(true); const [collapsed, setCollapsed] = useState<boolean>(scene === 'chat_dashboard');
// 展开或收起列表按钮样式 // 展开或收起列表按钮样式
const triggerStyle: React.CSSProperties = useMemo(() => { const triggerStyle: React.CSSProperties = useMemo(() => {
@@ -207,7 +209,7 @@ const ChatSider: React.FC<{
item={{ item={{
label: t('assistant'), label: t('assistant'),
key: 'default', key: 'default',
icon: <Image src="/logo_s_latest.png" alt="default" width={24} height={24} />, icon: <Image src="/LOGO_SMALL.png" alt="default" width={24} height={24} className='flex-1' />,
default: true, default: true,
}} }}
order={order} order={order}

View File

@@ -177,10 +177,18 @@ const Canvas: React.FC<Props> = () => {
} }
async function handleSaveFlow() { async function handleSaveFlow() {
const { name, label, description = '', editable = false } = form.getFieldsValue(); const { name, label, description = '', editable = false, deploy = false } = form.getFieldsValue();
const reactFlowObject = mapHumpToUnderline(reactFlow.toObject() as IFlowData); const reactFlowObject = mapHumpToUnderline(reactFlow.toObject() as IFlowData);
if (id) { if (id) {
const [, , res] = await apiInterceptors(updateFlowById(id, { name, label, description, editable, uid: id, flow_data: reactFlowObject })); const [, , res] = await apiInterceptors(updateFlowById(id, {
name,
label,
description,
editable,
uid: id,
flow_data: reactFlowObject,
state: deploy ? 'deployed' : 'developing',
}));
setIsModalVisible(false); setIsModalVisible(false);
if (res?.success) { if (res?.success) {
message.success('编辑成功'); message.success('编辑成功');
@@ -190,7 +198,7 @@ const Canvas: React.FC<Props> = () => {
message.error(res?.err_msg); message.error(res?.err_msg);
} }
} else { } else {
const [_, res] = await apiInterceptors(addFlow({ name, label, description, editable, flow_data: reactFlowObject })); const [_, res] = await apiInterceptors(addFlow({ name, label, description, editable, flow_data: reactFlowObject, state: deploy ? 'deployed' : 'developing' }));
setIsModalVisible(false); setIsModalVisible(false);
replace('/construct/flow'); replace('/construct/flow');
message.success('创建成功'); message.success('创建成功');
@@ -274,7 +282,7 @@ const Canvas: React.FC<Props> = () => {
<Form.Item label="Editable" name="editable" initialValue={id ? flowInfo?.editable : true} valuePropName="checked"> <Form.Item label="Editable" name="editable" initialValue={id ? flowInfo?.editable : true} valuePropName="checked">
<Checkbox></Checkbox> <Checkbox></Checkbox>
</Form.Item> </Form.Item>
<Form.Item label="Deploy" name="deploy" initialValue={id ? flowInfo?.deploy : true} valuePropName="checked"> <Form.Item label="Deploy" name="deploy" initialValue={id ? (flowInfo?.state === 'deployed' || flowInfo?.state === 'running') : true} valuePropName="checked">
<Checkbox></Checkbox> <Checkbox></Checkbox>
</Form.Item> </Form.Item>
<Form.Item wrapperCol={{ offset: 8, span: 16 }}> <Form.Item wrapperCol={{ offset: 8, span: 16 }}>