diff --git a/src/pages/config/Config.jsx b/src/pages/config/Config.jsx
index 1d3e4f6..f32fb17 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 } from 'antd';
-import { SettingOutlined, DatabaseOutlined, RobotOutlined, SlidersOutlined } from '@ant-design/icons';
+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 './Config.css';
const { Option } = Select;
@@ -8,13 +8,21 @@ 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: 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模型配置
@@ -25,6 +33,49 @@ const Config = () => {
{ 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 = {
refreshInterval: 30, // 秒
@@ -47,6 +98,46 @@ 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';
@@ -117,8 +208,10 @@ const Config = () => {
{
title: '操作',
key: 'action',
- render: () => (
-
+ render: (_, record) => (
+ } onClick={() => openDataSourceConfig(record)}>
+ 编辑
+
)
}
]}
@@ -164,8 +257,10 @@ const Config = () => {
{
title: '操作',
key: 'action',
- render: () => (
-
+ render: (_, record) => (
+ } onClick={() => openAiModelConfig(record)}>
+ 配置
+
)
}
]}
@@ -308,6 +403,297 @@ const Config = () => {
+
+ {/* AI模型详细配置模态框 */}
+ setAiModelModalVisible(false)}
+ width={900}
+ footer={[
+ ,
+
+ ]}
+ >
+
+
+
+ {/* 数据源详细配置模态框 */}
+ setDataSourceModalVisible(false)}
+ width={900}
+ footer={[
+ ,
+
+ ]}
+ >
+
+
);
};