-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeepseek_code_agent2.py
More file actions
41 lines (33 loc) · 1.23 KB
/
deepseek_code_agent2.py
File metadata and controls
41 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""DeepSeek Code Agent v2 入口:装配 agent_v2.agent_core 与 HTTP 路由。
原版 deepseek_code_agent.py 保留不动。实现细节见 agent_v2/agent_core.py。
"""
from __future__ import annotations
from agent_v2.http_app import create_app
from agent_v2 import agent_core as _core
app = create_app()
def main() -> None:
from util.config_loader import load_config
import sys
import uvicorn
load_config(verbose=True)
port_str = str(_core.AGENT_CONFIG["AGENT_SERVER_PORT"]).strip()
if not port_str:
print("FATAL: AGENT_SERVER_PORT 未设置!请在 config.ini 的 [server] 节配置 port", flush=True)
sys.exit(1)
if not _core._chat_api_key_available():
print(
"⚠️ WARNING: API Key 未配置或为空!请在 config.ini 的 [model] 节设置 api_key 或环境变量 CHAT_API_KEY",
file=sys.stderr,
flush=True,
)
print("⚠️ 或通过环境变量 CHAT_API_KEY 设置", file=sys.stderr, flush=True)
uvicorn.run(
app,
host=_core.AGENT_CONFIG["AGENT_SERVER_HOST"],
port=int(port_str),
timeout_graceful_shutdown=5,
)
if __name__ == "__main__":
main()