Skip to content

Commit e9891c3

Browse files
authored
Merge pull request #143 from heshengtao/dev
Dev
2 parents 66f7608 + a78edb8 commit e9891c3

File tree

12 files changed

+2450
-732
lines changed

12 files changed

+2450
-732
lines changed

config/settings_template.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"max_rounds": 0,
1212
"selectedProvider": null,
1313
"top_p": 1,
14+
"reasoning_effort": null,
1415
"extra_params":[],
1516
"systemSettings": {
1617
"language": "zh-CN",
@@ -69,7 +70,8 @@
6970
"base_url": "",
7071
"api_key": "",
7172
"selectedProvider": null,
72-
"temperature": 0.7
73+
"temperature": 0.7,
74+
"reasoning_effort": null
7375
},
7476
"vision": {
7577
"enabled": false,
@@ -130,6 +132,15 @@
130132
"e2b_api_key": "",
131133
"sandbox_url":"http://127.0.0.1:8080"
132134
},
135+
"HASettings": {
136+
"enabled": false,
137+
"api_key": "",
138+
"url": "http://127.0.0.1:8123"
139+
},
140+
"chromeMCPSettings": {
141+
"enabled": false,
142+
"url": "http://127.0.0.1:12306/mcp"
143+
},
133144
"custom_http":[],
134145
"qqBotConfig": {
135146
"QQAgent":"super-model",
@@ -186,7 +197,14 @@
186197
"gsvPromptLang": "zh",
187198
"gsvPromptText": "",
188199
"gsvRefAudioPath": "",
189-
"gsvAudioOptions": []
200+
"gsvAudioOptions": [],
201+
"selectedProvider": null,
202+
"vendor": "OpenAI",
203+
"model": "",
204+
"base_url": "",
205+
"api_key": "",
206+
"openaiVoice":"alloy",
207+
"openaiSpeed": 1.0
190208
},
191209
"liveConfig": {
192210
"onlyDanmaku": true,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
"nsis": {
123123
"oneClick": false,
124124
"allowElevation": true,
125+
"allowToChangeInstallationDirectory": true,
125126
"artifactName": "${productName}-Setup-${version}.${ext}",
126127
"uninstallDisplayName": "${productName}",
127128
"createDesktopShortcut": true

py/mcp_clients.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,18 @@ async def connect(self, config: dict) -> AsyncIterator["ConnectionManager"]:
3939
read, write = await stack.enter_async_context(stdio_client(server_params))
4040
else:
4141
mcptype = config.get("type", "ws")
42+
if "streamable" in mcptype:
43+
mcptype = "streamablehttp"
4244
client_map = {
4345
"ws": websocket_client,
4446
"sse": sse_client,
4547
"streamablehttp": streamablehttp_client,
4648
}
47-
client = client_map[mcptype](config["url"])
49+
headers = config.get("headers", {})
50+
if headers:
51+
client = client_map[mcptype](config["url"], headers=headers)
52+
else:
53+
client = client_map[mcptype](config["url"])
4854
transport = await stack.enter_async_context(client)
4955
if mcptype == "streamablehttp":
5056
read, write, _ = transport
@@ -69,6 +75,7 @@ def __init__(self) -> None:
6975
self._monitor_task: Optional[asyncio.Task] = None
7076
self._shutdown = False
7177
self._on_failure_callback: Optional[callable] = None # 新增:失败回调
78+
self._tools: list[str] = []
7279

7380
async def initialize(self, server_name: str, server_config: dict, on_failure_callback: Optional[callable] = None) -> None:
7481
"""非阻塞初始化:拉起连接监控协程"""
@@ -116,6 +123,7 @@ async def get_openai_functions(self):
116123
if not self._conn or not self._conn.session:
117124
return []
118125
tools = (await self._conn.session.list_tools()).tools
126+
self._tools = [t.name for t in tools]
119127
return [
120128
{
121129
"type": "function",

server.py

Lines changed: 353 additions & 16 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)