feat: add ModelAccess to settings page (#29)

* feat: Update site name to DataMate and refine text for AI data processing

* feat: Refactor settings page and implement model access functionality

- Created a new ModelAccess component for managing model configurations.
- Removed the old Settings component and replaced it with a new SettingsPage component that integrates ModelAccess, SystemConfig, and WebhookConfig.
- Added SystemConfig component for managing system settings.
- Implemented WebhookConfig component for managing webhook configurations.
- Updated API functions for model management in settings.apis.ts.
- Adjusted routing to point to the new SettingsPage component.
This commit is contained in:
chenghh-9609
2025-10-28 16:02:18 +08:00
committed by GitHub
parent a4b5238621
commit acafe70d90
14 changed files with 662 additions and 444 deletions

View File

@@ -0,0 +1,86 @@
import { Card, Divider, Input, Select, Switch, Button, Form, App } from "antd";
import { useState } from "react";
export default function SystemConfig() {
const { message } = App.useApp();
// System Settings State
const [systemConfig, setSystemConfig] = useState({
siteName: "DataMate",
maxFileSize: "100",
autoBackup: true,
logLevel: "info",
sessionTimeout: "30",
enableNotifications: true,
});
const logLevelOptions = [
{ value: "debug", label: "Debug" },
{ value: "info", label: "Info" },
{ value: "warn", label: "Warning" },
{ value: "error", label: "Error" },
];
const handleSaveSystemSettings = () => {
// Save system settings logic
console.log("Saving system settings:", systemConfig);
message.success("系统设置已保存");
};
return (
<Card>
<Form
onValuesChange={(changedValues) => {
setSystemConfig((prevConfig) => ({
...prevConfig,
...changedValues,
}));
}}
layout="vertical"
>
<div className="grid grid-cols-2 gap-6">
<Form.Item name="siteName" label="站点名称">
<Input />
</Form.Item>
<Form.Item name="maxFileSize" label="最大文件大小 (MB)">
<Input type="number" />
</Form.Item>
<Form.Item name="logLevel" label="日志级别">
<Select options={logLevelOptions}></Select>
</Form.Item>
<Form.Item name="sessionTimeout" label="会话超时 (分钟)">
<Input type="number" />
</Form.Item>
</div>
<Divider />
<div className="space-y-4">
<h4 className="font-medium"></h4>
<div className="space-y-3">
<div className="flex items-center justify-between">
<div>
<span></span>
<p className="text-sm text-gray-500"></p>
</div>
<Form.Item name="autoBackup" valuePropName="checked">
<Switch />
</Form.Item>
</div>
<div className="flex items-center justify-between">
<div>
<span></span>
<p className="text-sm text-gray-500"></p>
</div>
<Form.Item name="enableNotifications" valuePropName="checked">
<Switch />
</Form.Item>
</div>
</div>
</div>
<div className="flex justify-end mt-6">
<Button type="primary" onClick={handleSaveSystemSettings}>
</Button>
</div>
</Form>
</Card>
);
}