diff --git a/src/pages/admin/AdminConfig.jsx b/src/pages/admin/AdminConfig.jsx
index 1602489..ad3aae6 100644
--- a/src/pages/admin/AdminConfig.jsx
+++ b/src/pages/admin/AdminConfig.jsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
-import { Card, Row, Col, Form, Input, Button, Select, Switch, InputNumber, Alert, Divider, Tabs } from 'antd';
+import { Card, Row, Col, Form, Input, Button, Select, Switch, InputNumber, Alert, Divider, Tabs, Table, Modal } from 'antd';
import { message } from 'antd';
-import { DatabaseOutlined, KeyOutlined, SettingOutlined, SaveOutlined, ToolOutlined } from '@ant-design/icons';
+import { DatabaseOutlined, KeyOutlined, SettingOutlined, SaveOutlined, ToolOutlined, RobotOutlined, EditOutlined } from '@ant-design/icons';
import './AdminConfig.css';
const { Option } = Select;
@@ -11,6 +11,9 @@ const { TabPane } = Tabs;
const AdminConfig = () => {
const [form] = Form.useForm();
const [messageApi, contextHolder] = message.useMessage();
+ const [aiModelModalVisible, setAiModelModalVisible] = useState(false);
+ const [currentAiModel, setCurrentAiModel] = useState(null);
+ const [aiModelForm] = Form.useForm();
// 组件挂载时获取配置
useEffect(() => {
@@ -384,6 +387,45 @@ const AdminConfig = () => {
}
};
+ // 打开AI模型配置模态框
+ const openAiModelConfig = (model) => {
+ setCurrentAiModel(model);
+ // 初始化表单数据
+ aiModelForm.setFieldsValue({
+ modelName: model.name,
+ apiKey: '',
+ apiBaseUrl: '',
+ temperature: 0.3,
+ maxTokens: 1000,
+ timeout: 30000,
+ retries: 3,
+ predictionPeriods: ['1H', '4H', '1D'],
+ confidenceThreshold: 70,
+ historyDataDays: 90,
+ technicalIndicators: {
+ enabled: true,
+ indicators: ['MACD', 'RSI', 'KDJ', 'MA', 'BOLL']
+ },
+ fundamentalAnalysis: {
+ enabled: true,
+ factors: ['资金流向', '持仓分析', '现货价格', '库存变化']
+ },
+ riskAssessment: {
+ enabled: true,
+ riskLevel: 'medium'
+ }
+ });
+ setAiModelModalVisible(true);
+ };
+
+ // 保存AI模型配置
+ const saveAiModelConfig = (values) => {
+ console.log('AI模型配置保存:', values);
+ // 模拟保存操作
+ setAiModelModalVisible(false);
+ messageApi.success('AI模型配置已保存');
+ };
+
return (
<>
{contextHolder}
@@ -1224,6 +1266,91 @@ const AdminConfig = () => {
>
)
+ },
+ {
+ label: AI模型配置,
+ key: 'aiModel',
+ children: (
+ <>
+ {/* AI模型配置 */}
+
+ (
+ {}} />
+ )
+ },
+ {
+ title: '操作',
+ key: 'action',
+ render: (_, record) => (
+ } onClick={() => openAiModelConfig(record)}>
+ 配置
+
+ )
+ }
+ ]}
+ rowKey="id"
+ />
+
+
+ {/* 模型参数调优 */}
+
+
+
+ >
+ )
}
]}
/>
@@ -1239,6 +1366,168 @@ const AdminConfig = () => {
+
+ {/* AI模型详细配置模态框 */}
+ setAiModelModalVisible(false)}
+ width={900}
+ footer={[
+ ,
+
+ ]}
+ >
+
+
>
);
diff --git a/src/pages/config/Config.jsx b/src/pages/config/Config.jsx
index cb1de27..7d7dc1c 100644
--- a/src/pages/config/Config.jsx
+++ b/src/pages/config/Config.jsx
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
-import { Card, Row, Col, Form, Input, Button, Select, Switch, Slider, Tag, Alert, Table, Modal, InputNumber, Radio, Space, Divider } from 'antd';
-import { SettingOutlined, DatabaseOutlined, RobotOutlined, SlidersOutlined, EditOutlined, SaveOutlined, CloseOutlined } from '@ant-design/icons';
+import { Card, Row, Col, Form, Input, Button, Select, Switch, Slider, Tag, Alert, InputNumber, Radio, Space, Divider } from 'antd';
+import { SettingOutlined, SlidersOutlined, SaveOutlined, CloseOutlined } from '@ant-design/icons';
import './Config.css';
const { Option } = Select;
@@ -8,73 +8,6 @@ const { Item } = Form;
const Config = () => {
const [form] = Form.useForm();
- const [aiModelModalVisible, setAiModelModalVisible] = useState(false);
- const [currentAiModel, setCurrentAiModel] = useState(null);
- const [aiModelForm] = Form.useForm();
- const [dataSourceModalVisible, setDataSourceModalVisible] = useState(false);
- const [currentDataSource, setCurrentDataSource] = useState(null);
- const [dataSourceForm] = Form.useForm();
-
- // 数据源配置
- const dataSources = [
- { id: 1, name: 'Wind', status: 'online', responseTime: '120ms', priority: 1, enabled: true },
- { id: 2, name: '同花顺', status: 'online', responseTime: '150ms', priority: 2, enabled: true },
- { id: 3, name: '东方财富', status: 'online', responseTime: '180ms', priority: 3, enabled: true },
- { id: 4, name: '新浪财经', status: 'offline', responseTime: '-', priority: 4, enabled: false },
- { id: 5, name: 'TQSDK', status: 'online', responseTime: '90ms', priority: 5, enabled: true },
- { id: 6, name: 'RQData', status: 'online', responseTime: '110ms', priority: 6, enabled: true }
- ];
-
- // AI模型配置
- const aiModels = [
- { id: 1, name: 'DeepSeek', accuracy: '85%', responseTime: '250ms', enabled: true },
- { id: 2, name: 'GPT-4', accuracy: '88%', responseTime: '350ms', enabled: false },
- { id: 3, name: 'Claude', accuracy: '82%', responseTime: '200ms', enabled: false },
- { id: 4, name: '自定义模型', accuracy: '78%', responseTime: '150ms', enabled: false }
- ];
-
- // AI模型详细配置
- const aiModelConfig = {
- modelName: 'DeepSeek',
- apiKey: 'sk-xxxxxxxxxxxxxxxxxxxxxxxx',
- apiBaseUrl: 'https://api.deepseek.com',
- temperature: 0.3,
- maxTokens: 1000,
- timeout: 30000,
- retries: 3,
- predictionPeriods: ['1H', '4H', '1D'],
- confidenceThreshold: 70,
- historyDataDays: 90,
- technicalIndicators: {
- enabled: true,
- indicators: ['MACD', 'RSI', 'KDJ', 'MA', 'BOLL']
- },
- fundamentalAnalysis: {
- enabled: true,
- factors: ['资金流向', '持仓分析', '现货价格', '库存变化']
- },
- riskAssessment: {
- enabled: true,
- riskLevel: 'medium'
- }
- };
-
- // 数据源详细配置
- const dataSourceConfig = {
- name: 'Wind',
- apiKey: 'your-api-key',
- apiSecret: 'your-api-secret',
- apiUrl: 'https://api.example.com',
- username: '',
- password: '',
- refreshInterval: 60, // 秒
- timeout: 10000, // 毫秒
- retries: 3,
- priority: 1,
- enabled: true,
- dataTypes: ['price', 'volume', 'openInterest', 'funding'],
- rateLimit: 100 // 每分钟请求限制
- };
// 系统配置参数
const systemParams = {
@@ -98,207 +31,10 @@ const Config = () => {
Alert.success('配置已保存');
};
- // 打开AI模型配置模态框
- const openAiModelConfig = (model) => {
- setCurrentAiModel(model);
- // 初始化表单数据
- aiModelForm.setFieldsValue({
- ...aiModelConfig,
- modelName: model.name
- });
- setAiModelModalVisible(true);
- };
-
- // 保存AI模型配置
- const saveAiModelConfig = (values) => {
- console.log('AI模型配置保存:', values);
- // 模拟保存操作
- setAiModelModalVisible(false);
- Alert.success('AI模型配置已保存');
- };
-
- // 打开数据源配置模态框
- const openDataSourceConfig = (dataSource) => {
- setCurrentDataSource(dataSource);
- // 初始化表单数据
- dataSourceForm.setFieldsValue({
- ...dataSourceConfig,
- name: dataSource.name,
- priority: dataSource.priority,
- enabled: dataSource.enabled
- });
- setDataSourceModalVisible(true);
- };
-
- // 保存数据源配置
- const saveDataSourceConfig = (values) => {
- console.log('数据源配置保存:', values);
- // 模拟保存操作
- setDataSourceModalVisible(false);
- Alert.success('数据源配置已保存');
- };
-
- // 获取数据源状态颜色
- const getDataSourceStatusColor = (status) => {
- return status === 'online' ? 'green' : 'red';
- };
-
- // 获取数据源状态文本
- const getDataSourceStatusText = (status) => {
- return status === 'online' ? '在线' : '离线';
- };
-
return (
配置管理
- {/* 数据源配置 */}
-
数据源配置}
- className="config-card"
- style={{ marginBottom: 24 }}
- >
- (
-
- {getDataSourceStatusText(status)}
-
- )
- },
- {
- title: '响应时间',
- dataIndex: 'responseTime',
- key: 'responseTime'
- },
- {
- title: '优先级',
- dataIndex: 'priority',
- key: 'priority',
- render: (priority) => (
-
- )
- },
- {
- title: '启用',
- dataIndex: 'enabled',
- key: 'enabled',
- render: (enabled) => (
- {}} />
- )
- },
- {
- title: '操作',
- key: 'action',
- render: (_, record) => (
- } onClick={() => openDataSourceConfig(record)}>
- 编辑
-
- )
- }
- ]}
- rowKey="id"
- />
-
-
-
- {/* AI模型配置 */}
- AI模型配置}
- className="config-card"
- style={{ marginBottom: 24 }}
- >
- (
- {}} />
- )
- },
- {
- title: '操作',
- key: 'action',
- render: (_, record) => (
- } onClick={() => openAiModelConfig(record)}>
- 配置
-
- )
- }
- ]}
- rowKey="id"
- />
-
- {/* 模型参数调优 */}
-
-
-
-
-
{/* 系统配置 */}
系统配置}
@@ -498,296 +234,7 @@ const Config = () => {
- {/* AI模型详细配置模态框 */}
- setAiModelModalVisible(false)}
- width={900}
- footer={[
- ,
-
- ]}
- >
-
-
-
- {/* 数据源详细配置模态框 */}
- setDataSourceModalVisible(false)}
- width={900}
- footer={[
- ,
-
- ]}
- >
-
-
);
};