优化:缓存查询与智能分析页面,修复组织下钻和草稿保留
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { usePageCache } from './pageCache';
|
||||
import { useRef, useState } from 'react';
|
||||
import { Alert, App, Button, Form, Input, Modal, Select, Spin, Tag } from 'antd';
|
||||
import { SettingOutlined } from '@ant-design/icons';
|
||||
@@ -10,6 +11,7 @@ export type AnalysisModelSettingsInput = { baseUrl: string; model: string; apiKe
|
||||
export function AnalysisApiSettings({ onUnauthorized }: { onUnauthorized: (error: unknown) => boolean }) {
|
||||
const { message } = App.useApp();
|
||||
const [form] = Form.useForm<AnalysisModelSettingsInput>();
|
||||
const { active } = usePageCache();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [saving, setSaving] = useState(false);
|
||||
@@ -54,7 +56,7 @@ export function AnalysisApiSettings({ onUnauthorized }: { onUnauthorized: (error
|
||||
};
|
||||
return <>
|
||||
<Button type="text" size="small" icon={<SettingOutlined />} onClick={() => void load()}>API 配置</Button>
|
||||
<Modal title="API 配置" open={open} width={540} onCancel={close} footer={<>
|
||||
<Modal title="API 配置" open={active && open} width={540} onCancel={close} footer={<>
|
||||
<Button onClick={close} disabled={saving}>关闭</Button>
|
||||
<Button loading={testing} disabled={loading || saving || !settings} onClick={() => void submit(true)}>测试连接</Button>
|
||||
<Button type="primary" loading={saving} disabled={loading || testing || !settings} onClick={() => void submit(false)}>保存并使用</Button>
|
||||
|
||||
Reference in New Issue
Block a user