model-diff-chatall
https://github.com/ai-shifu/ChatALL
https://gitee.com/gigy/ChatALL

功能
多个大模型同时询问,合并输出。
适用于评估,提高模型结果的准确度。
目录
ChatALL/
├── .devcontainer/
│ ├── devcontainer.json # 开发容器配置文件
├── .github/
│ ├── FUNDING.yml # 赞助信息配置
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml # Bug 报告模板
│ │ ├── config.yml # Issue 模板配置
│ │ └── feature_request.yml # 功能请求模板
│ └── workflows/
│ ├── deploy.yml # GitHub Pages 部署工作流
│ ├── release.yml ⭐# 多平台发布工作流
│ └── static.yml # 静态资源部署工作流
├── .gitignore # Git 忽略文件配置
├── .prettierrc.js ⭐# 代码格式化配置
├── public/
│ ├── bots/ ⭐# 机器人静态资源目录
│ ├── favicon.ico # 网站图标
│ └── index.html ⭐# 入口 HTML 文件
├── screenshots/ 项目截图 1
├── src/
│ ├── App.vue # Vue 根组件
│ ├── assets/ # 静态资源目录
│ ├── background.js ⭐# 主进程逻辑。网页登录,获取浏览器缓存
│ ├── bots/ ⭐# 模型问答的请求响应
│ │ ├── microsoft/
│ │ │ └── AzureOpenAIAPIBot.js # Azure OpenAI 机器人
│ │ ├── zhipu/
│ │ │ └── ChatGLM4Bot.js # 智谱 GLM4 机器人
│ │ ├── SkyWorkBot.js # SkyWork 机器人
│ │ └── lmsys/
│ │ └── LMSYSBot.js # LMSYS 机器人
│ │ └── index.js ⭐# 实例化 bots中的{ModelName}Bot.js
│ ├── components/
│ │ └── BotSettings/ ⭐
│ │ ├── LoginSetting.vue ⭐# 通用登录组件
│ │ ├── MOSSBotSettings.vue # MOSS 机器人设置
│ │ ├── ClaudeAIBotSettings.vue # ClaudeAI 设置
│ │ ├── ChatWindow.vue # 聊天窗口组件
│ │ ├── MessageList.vue # 消息列表组件
│ │ ├── MessageItem.vue # 单个消息项组件
│ │ ├── BotSelector.vue # 机器人选择器组件
│ │ ├── SettingsButton.vue # 设置按钮组件
│ │ ├── LoadingSpinner.vue # 加载中提示组件
│ │ └── SettingsModal.vue ⭐# 设置模板
│ ├── composables/ # Vue 组合式 API 目录
│ ├── helpers/
│ │ └── template-helper.js # 模板辅助函数
│ ├── i18n/ ⭐
│ │ └── locales/
│ │ ├── es.json # 西班牙语翻译
│ │ ├── fr.json # 法语翻译
│ │ └── zh.json # 中文翻译
│ ├── main.js ⭐# 应用入口文件
│ ├── store/
│ │ └── index.js # ⭐存储状态管理
│ └── prompts/
│ └── prompts-zhtw.json # 繁体中文提示配置
├── .husky/ # Git Hooks 配置目录
├── CONTRIBUTION.md # 贡献指南
├── LICENSE # 开源许可证
├── README.md # 项目说明文档
├── README_*.md # 多语言文档(DE-DE/ES-ES 等)
├── babel.config.js # Babel 编译配置
├── jsconfig.json # JavaScript 配置
├── package-lock.json # 依赖锁定文件
├── package.json # 项目配置
└── vue.config.js # Vue 项目配置
quick-start
运行
- 安装 Node v20.19.0,https://nodejs.cn/en/download 。
node -v、npm -v确认版本号。@achrinza/node - ipc@9.2.8要求版本号最高为21- 当然也可以用 vscode 的devcontainer,开发时,reopen in docker container
- 下载依赖,编译运行
# 添加 npm 镜像源,默认镜像源地址 https://registry.npmjs.org
# windows
npm config set registry https://registry.npmmirror.com
# 查看镜像源
npm config get registry
# 清除 npm 缓存
npm cache clean --force
# 下载依赖
npm install
# 下载单个依赖 electron
npm install electron
# 下载依赖时打印详细信息
--npm install --verbose
# 运行
npm run electron:serve
# Prettier 代码格式化
# 因为public\index.html 有格式化错误,所以,避免格式化html:新建.prettierignore,填入 **/*.html
npx prettier --write .
新增
请求逻辑:
- 网页获取 token:
src\background.js#createWindow网页登录,获取浏览器缓存。- 已登录确认:
src\bots\{ModelName}Bot.js#_checkAvailability()
- 已登录确认:
- 本地存 token:通过中介
src\components\BotSettings\{ModelName}BotSettings.vue#mounted,存入src\store\index.js#set{ModelName}API{return status} - 请求添加 token:
src\bots\{ModelName}Bot.js,_sendPrompt问答请求,更新 tokensrc\bots\index.js,用于实例化{ModelName}Bot.js
配置
footer 可选 {ModelName}:
- 添加logo:
public\bots\{modelName}-logo.png - 配置国际化文件,如
src\i18n\locales\en.json
设置中显示 {ModelName}: src\components\SettingsModal.vue引用src\components\BotSettings\{ModelName}BotSettings
不同请求方式:
- 网页请求,如
src\bots\ClaudeAIBot.js - API请求,如
src\bots\anthropic\ClaudeAPIBot.js
局限
接口变动比较快。
如Kimi,要想识别链接,需在请求接口,格式化链接。
// 输入:文字
// 请求时为:"content":"文字"
// 输入:https:xxx 总结
// 请求时为:"content":"<url id=\"\" type=\"url\" status=\"\" title=\"\" wc=\"\">https:xxx</url> 总结"
卡点
网页请求加豆包?机器人对话接口有问题。
- ID参数的生成方式不确定
- 身份验证参数不确定
三级ID:conversation_id > section_id > local_message_id
- "conversation_id": "2285555073851911", 当前会话ID。
- "section_id": "2285555073852125", 50条记录一个区块。
- "local_message_id":"72038680-0bc2-11f0-a281-351e8cd59333",单条消息记录。
- 一次请求是一条记录,一次响应也是一条记录。
# 请求示例值无效,已做过处理
# 首次请求
curl -X POST 'https://www.doubao.com/samantha/chat/completion' \
--header 'agw-js-conv: str' \
--header 'Cookie: sessionid=ef583c7f4d20269637dd37858c85dddd;' \
--data-raw '{
"messages": [
{
"content": "{\text\:\1\}",
"content_type": 2001,
"attachments": [],
"references": []
}
],
"completion_option": {
"is_regen": false,
"with_suggest": true,
"need_create_conversation": true,
"launch_stage": 1,
"is_replace": false,
"is_delete": false,
"message_from": 0,
"use_deep_think": false,
"event_id": "0"
},
"conversation_id": "0",
"local_conversation_id": "local_2285555073852125",
"local_message_id": "79b4de14-3eb6-4a3a-ade4-351e8cd59333"
}'
# return: conversation_id; section_id; local_message_id=reply_id,message_id
# 因为ID错误,导致 "message": "last: cannot extract the last element of an empty slice [biz error]"
# 后续请求
curl -X POST 'https://www.doubao.com/samantha/chat/completion' \
--header 'agw-js-conv: str' \
--header 'Cookie: sessionid=ef583c7f4d20269637dd37858c85dddd;' \
--data-raw '{
"messages": [
{
"content": "{\"text\":\"1\"}",
"content_type": 2001,
"attachments": [],
"references": []
}
],
"section_id": "2285555073852125",
"local_message_id":"72038680-0bc2-11f0-a281-351e8cd59333"
}'