Pārlūkot izejas kodu

【新增】添加配置文件模板并更新配置结构

- 新增 Config.example.json 和 ServerConfig.example.json 配置文件模板
- 更新 Config.py 中的 TOOL_CONFIG 结构,将其嵌套在 base_tool 下
- 在 .gitignore 中添加新配置文件
PJ568 1 gadu atpakaļ
vecāks
revīzija
68f3ab4ea4
5 mainītis faili ar 76 papildinājumiem un 7 dzēšanām
  1. 4 1
      .gitignore
  2. 1 1
      VERSION
  3. 44 0
      configs/Config.example.json
  4. 20 0
      configs/ServerConfig.example.json
  5. 7 5
      yaa/Config/Config.py

+ 4 - 1
.gitignore

@@ -1 +1,4 @@
-__pycache__
+__pycache__
+
+Config.json
+ServerConfig.json

+ 1 - 1
VERSION

@@ -1 +1 @@
-0.2.0
+0.3.0

+ 44 - 0
configs/Config.example.json

@@ -0,0 +1,44 @@
+{
+    "yaa": {
+        "stream": false
+    },
+    "llm_api": {
+        "provider": {
+            "api_url": "https://api.openai.com/v1/chat/completions",
+            "api_key": "",
+            "model_name": "gpt-4",
+            "model_type": {
+                "is_function_call": false,
+                "is_reasoning": false
+            },
+            "cost_per_ktoken": 0.03,
+            "cost_unit": "USD",
+            "max_tokens": 2000,
+            "model_settings": {
+                "use_custom_temp": false,
+                "temperature": 0.7
+            }
+        },
+        "stream": true,
+        "request_timeout": 360,
+        "interval": 0,
+        "retry": {
+            "times": 3,
+            "delay": 5
+        }
+    },
+    "prompt": {
+        "function": "TODO",
+        "system": "TODO",
+        "error": "TODO:{error}"
+    },
+    "tool": {
+        "base_tool": {
+            "auto_approve": false,
+            "timeout": 30,
+            "max_memory": "512MB",
+            "cpu_threshold": 0.8,
+            "interrupt_monitor": true
+        }
+    }
+}

+ 20 - 0
configs/ServerConfig.example.json

@@ -0,0 +1,20 @@
+{
+    "yaa_server": {
+        "ip": "0.0.0.0",
+        "port": 12345,
+        "max_connections": 100,
+        "max_receive": 1024,
+        "timeout": 60
+    },
+    "security": {
+        "auth_required": true,
+        "api_key_header": "YAA-API-KEY",
+        "api_key": [
+            {
+                "key": "636ebda2dccc312b88aed7c54786f8678d33d4f878da41c5302b3dcde563055b61e8ca047d333c45e9be1adc342ceb2850f23f294a8b1b1c2d2dd016713fef58"
+            }
+        ],
+        "rate_limit": "100/1m",
+        "max_request_size": "10MB"
+    }
+}

+ 7 - 5
yaa/Config/Config.py

@@ -49,11 +49,13 @@ class Config:
     
     # TODO 工具调用配置
     TOOL_CONFIG = {
-        'auto_approve': False,
-        'timeout': 30,
-        'max_memory': '512MB',
-        'cpu_threshold': 0.8,
-        'interrupt_monitor': True
+        'base_tool': {
+            'auto_approve': False,
+            'timeout': 30,
+            'max_memory': '512MB',
+            'cpu_threshold': 0.8,
+            'interrupt_monitor': True
+        }
     }
 
     @classmethod