feat: add OpenAI-compatible AI provider plugin with SSE streaming support

- Implemented the OpenAI-compatible AI provider plugin, including configuration, chat, and chat_stream functionalities.
- Added support for SSE streaming and tool calls.
- Integrated Boost.JSON for JSON handling.
- Created CMake configuration for the plugin.
- Added error handling and logging throughout the plugin.
This commit is contained in:
2026-05-31 05:37:04 +08:00
parent f6cb51b40a
commit ba7382db2a
61 changed files with 163 additions and 147 deletions

View File

@@ -16,7 +16,7 @@ dstalk 是一款 AI 编程助手命令行工具, 通过调用大模型在终端
┌───────────────────────────────────────────────────────────┐
│ 前端层 (Frontends) │
│ ┌──────────────────┐ ┌──────────────────────────┐ │
│ │ dstalk-cli │ │ dstalk-gui │ │
│ │ dstalk_cli │ │ dstalk_gui │ │
│ │ ANSI 终端 UI │ │ SDL3 图形化 UI │ │
│ └────────┬─────────┘ └─────────────┬─────────────┘ │
│ └──────────────┬───────────────┘ │
@@ -24,7 +24,7 @@ dstalk 是一款 AI 编程助手命令行工具, 通过调用大模型在终端
└──────────────────────────┼─────────────────────────────────┘
┌──────────────────────────▼─────────────────────────────────┐
│ 核心层 (dstalk-core.dll) — 插件宿主 │
│ 核心层 (dstalk_core.dll) — 插件宿主 │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Host: 插件加载 · 服务注册 · 事件总线 · 配置管理 │ │
│ └──────────────────────────────────────────────────────┘ │
@@ -33,15 +33,15 @@ dstalk 是一款 AI 编程助手命令行工具, 通过调用大模型在终端
│ │ (ai) │ │ (ai) │ │ (http) │ │ 客户端 │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
│ │ session │ │ context │ │ file-io │ │ tools │ │
│ │ session │ │ context │ │ file_io │ │ tools │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
```
- **dstalk-core** —— C11/C++20 插件化宿主 DLL, 负责插件加载、服务注册、事件总线、配置管理
- **dstalk-cli** —— 命令行前端, ANSI 终端 UI
- **dstalk-gui** —— 图形化前端, SDL3 跨平台窗口
- **plugins/** —— 9 个功能插件, 编译为独立 DLL, 通过 C ABI 动态注册服务
- **dstalk_core** —— C11/C++20 插件化宿主 DLL, 负责插件加载、服务注册、事件总线、配置管理
- **dstalk_cli** —— 命令行前端, ANSI 终端 UI
- **dstalk_gui** —— 图形化前端, SDL3 跨平台窗口
- **plugins_base/、plugins_middle/、plugins_upper/** —— 9 个功能插件按三层架构分布, 编译为独立 DLL, 通过 C ABI 动态注册服务
核心与界面完全解耦, 可编写自己的前端或把 AI 能力嵌入到现有工具中。
@@ -65,7 +65,7 @@ dstalk 是一款 AI 编程助手命令行工具, 通过调用大模型在终端
cd tools && setup.bat # 1. 安装工具链 (CMake / Ninja / LLVM / Conan2)
build.bat # 2. 编译
# 3. 创建 config.toml # 见教程: docs/tutorial/quick-start.md
build/dstalk-cli/dstalk-cli.exe # 4. 运行
build/dstalk_cli/dstalk_cli.exe # 4. 运行
# 5. 输入自然语言 # "帮我写一个 C 程序"
```