Files
flomo-ai/docs/superpowers/specs/2026-05-08-multi-llm-design.md
2026-05-08 22:01:21 +08:00

55 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 多模型并行调用功能设计
## 概述
支持同时配置最多3个LLM大模型主页面同时显示3个结果框发送时并行调用所有已配置的模型。
## 配置页面 (SecondActivity)
### 布局
垂直排列3个模型配置卡片每组包含
- 配置名称 (EditText)
- Base URL (EditText)
- API Key + 显示/隐藏切换 (EditText + ImageButton)
- Model (EditText)
- 测试连接按钮 + 状态文本
### 交互
- 每个模型独立的「测试连接」按钮
- 保存时持久化3个模型的配置到 SharedPreferences
## 主页面 (MainActivity)
### 布局
结果显示区改为水平 ScrollView内含3个结果卡片
- 每个卡片 300dp 宽
- 包含:模型名称、状态标签、结果文本框、复制按钮
- 未配置的模型卡片显示为空或隐藏
### 发送逻辑
1. 获取所有已配置的模型列表
2. 并行启动 coroutine 给每个模型发送请求
3. 各自更新各自的结果框
4. 任意模型完成后更新总状态
## 数据结构
```kotlin
data class LLMConfig(
val name: String,
val baseUrl: String,
val apiKey: String,
val model: String
)
data class SettingsData(
val llmConfigs: List<LLMConfig> // 支持1-3个
)
```
## 文件变更
1. `activity_second.xml` - 增加2组模型配置卡片
2. `SecondActivity.kt` - 加载/保存3个模型配置3个独立测试功能
3. `activity_main.xml` - 结果区改为水平布局3个结果卡片
4. `MainActivity.kt` - 并行调用所有模型,各自更新结果