Skip to content

Commit 67d143d

Browse files
committed
增加助手功能,增加1服务商对多模型功能,增加本地工具功能,支持文件系统,网页抓取,系统信息
1 parent ee1fe65 commit 67d143d

51 files changed

Lines changed: 6608 additions & 1018 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 136 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,117 @@ TChat的作者是大陆人,交流最好用简体中文,如果不会使用那
2626

2727

2828

29-
# v1.0
29+
# v1.2
30+
31+
### 新增功能
32+
33+
- **服务商多模型管理**
34+
- 服务商配置支持从 API 拉取模型列表
35+
- 拉取后弹窗选择要保存的模型(支持多选)
36+
- 已保存模型可单独删除
37+
- 支持手动添加自定义模型
38+
39+
- **聊天页面模型选择**
40+
- 在聊天页面输入框上方工具栏选择模型
41+
- 使用 **Lucide Icon** 显示模型类型图标
42+
- OpenAI → ✨ Sparkles
43+
- Claude → 🤖 Bot
44+
- Gemini → 🧠 BrainCircuit
45+
46+
- **二维码分享优化**
47+
- 使用 ModalBottomSheet 样式替代弹窗
48+
- 支持选择是否包含模型列表
49+
- 显示预计数据大小
50+
- 二维码卡片显示服务商名称和端点
51+
52+
- **Material You 界面重构**
53+
- 服务商列表页使用 ElevatedCard 卡片设计
54+
- 服务商编辑页使用卡片分组布局
55+
- 使用 FAB 浮动按钮替代底部固定按钮
56+
- 删除"设为当前使用"按钮(简化操作)
57+
58+
- **本地工具调用功能**
59+
- 支持 AI 调用本地工具完成任务
60+
- **三大提供商全支持**:OpenAI、Anthropic Claude、Google Gemini 均可使用工具
61+
- 聊天工具栏添加工具开关按钮
62+
- 工具执行结果可展开查看详情
63+
- 支持的工具:
64+
- `read_file` - 读取文件内容
65+
- `write_file` - 写入文件内容
66+
- `list_directory` - 列出目录文件
67+
- `delete_file` - 删除文件
68+
- `create_directory` - 创建目录
69+
- `web_fetch` - 网页内容抓取
70+
- `get_system_info` - 获取设备信息
71+
72+
---
73+
74+
### 技术改进详情
75+
76+
#### 1. 工具调用循环机制
77+
78+
**功能**:AI 可以连续调用多个工具完成复杂任务
79+
80+
**实现**
81+
- 发送消息时携带工具定义给 AI
82+
- AI 返回工具调用请求时自动执行
83+
- 执行结果发送回 AI 继续对话
84+
- 最多支持 10 轮工具调用,避免无限循环
85+
86+
---
87+
88+
#### 2. 工具结果可视化
89+
90+
**功能**:在聊天界面显示工具执行详情
91+
92+
**实现**
93+
- 每个工具调用显示为独立的可点击卡片
94+
- 显示"调用 xxx",点击可展开查看详细执行结果
95+
- 成功使用主题色,失败使用错误色
96+
97+
---
98+
99+
#### 3. 数据库支持工具数据
100+
101+
**修改**
102+
- MessageEntity 添加 `toolCallId``toolName``toolCallsJson``toolResultsJson` 字段
103+
- 数据库版本 5 → 6 迁移
104+
105+
---
106+
107+
#### 4. 无参数工具兼容性修复
108+
109+
**问题**`get_system_info` 等无参数工具在某些 API(如 Anthropic)中无法被调用
110+
111+
**原因**:无参数工具的 `parameters` 返回 `null`,但 Anthropic 等 API 要求必须有有效的 `input_schema`
112+
113+
**修复**:无参数工具改为返回空对象 `InputSchema.Obj(emptyMap(), emptyList())`
114+
115+
---
116+
117+
### 涉及文件
118+
119+
| 模块 | 文件 | 修改 |
120+
|------|------|------|
121+
| network | AIProvider.kt | 添加工具调用相关数据类 |
122+
| network | OpenAIProvider.kt | 支持 Function Calling |
123+
| network | AnthropicProvider.kt | 支持 Tool Use(工具调用) |
124+
| network | GeminiProvider.kt | 支持 Function Calling |
125+
| data | Tool.kt | 工具定义和执行接口 |
126+
| data | LocalTools.kt | 本地工具实现 |
127+
| data | Message.kt | 添加 ToolCallData、ToolResultData |
128+
| data | MessageEntity.kt | 添加工具相关字段 |
129+
| data | ChatRepository.kt | 添加 ChatConfig 配置 |
130+
| data | ChatRepositoryImpl.kt | 工具调用循环实现 |
131+
| data | AppDatabase.kt | 版本 6,工具字段迁移 |
132+
| feature-chat | ChatScreen.kt | 工具开关按钮 |
133+
| feature-chat | MessageItem.kt | 工具结果展示 UI |
134+
| app | MainActivity.kt | LocalTools 集成 |
135+
136+
---
137+
30138

31-
### 首个正式版本发布!
32-
### 核心功能
33-
- **多服务商支持**
34-
- Open AI
35-
- Anthropic Claude
36-
- Gemini
37-
**灵活的服务商配置**
38-
- 自定义 API Key
39-
- 自定义 API 端点(支持第三方代理)
40-
- 从 API 自动拉取可用模型列表
41-
- 手动输入自定义模型名称
42-
- 多服务商配置管理,一键切换
43-
- **聊天功能**
44-
- 非流式回复,实时显示 AI 响应
45-
- 多会话管理
46-
- 侧边栏聊天记录导航
47-
- 新建/删除/切换对话
48139

49-
###还没实现的功能:
50-
- 流式信息输出
51-
- 输出内容TPS/token速度/tokens数量显示
52-
- 持久化数据存储(目前仅支持API提供商的服务持久化存储)
53140

54141
# v1.1
55142

@@ -140,6 +227,33 @@ TChat的作者是大陆人,交流最好用简体中文,如果不会使用那
140227

141228

142229

230+
# v1.0
231+
232+
### 首个正式版本发布!
233+
### 核心功能
234+
- **多服务商支持**
235+
- Open AI
236+
- Anthropic Claude
237+
- Gemini
238+
**灵活的服务商配置**
239+
- 自定义 API Key
240+
- 自定义 API 端点(支持第三方代理)
241+
- 从 API 自动拉取可用模型列表
242+
- 手动输入自定义模型名称
243+
- 多服务商配置管理,一键切换
244+
- **聊天功能**
245+
- 非流式回复,实时显示 AI 响应
246+
- 多会话管理
247+
- 侧边栏聊天记录导航
248+
- 新建/删除/切换对话
249+
250+
###还没实现的功能:
251+
- 流式信息输出
252+
- 输出内容TPS/token速度/tokens数量显示
253+
- 持久化数据存储(目前仅支持API提供商的服务持久化存储)
254+
255+
256+
143257

144258
## 许可证
145259

README_EN.md

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,63 @@ The author of TChat is from mainland China. It's best to communicate in Simplifi
2525

2626

2727

28+
# v1.2
29+
30+
### New Features
31+
32+
- **Provider Multi-model Management**
33+
- Provider configuration supports fetching model list from API
34+
- Pop-up to select models to save after fetching (supports multi-select)
35+
- Saved models can be deleted individually
36+
- Supports manually adding custom models
37+
38+
- **Chat Page Model Selection**
39+
- Select models from toolbar above chat input
40+
- Uses **Lucide Icon** to display model type icons
41+
- OpenAI → ✨ Sparkles
42+
- Claude → 🤖 Bot
43+
- Gemini → 🧠 BrainCircuit
44+
45+
- **QR Code Sharing Optimization**
46+
- Uses ModalBottomSheet style instead of dialog
47+
- Supports choosing whether to include model list
48+
- Shows estimated data size
49+
- QR code card displays provider name and endpoint
50+
51+
- **Material You UI Redesign**
52+
- Provider list page uses ElevatedCard design
53+
- Provider edit page uses card group layout
54+
- Uses FAB floating button instead of fixed bottom button
55+
- Removed "Set as Current" button (simplified operation)
56+
57+
- **Local Tool Calling Feature**
58+
- Supports AI calling local tools to complete tasks
59+
- **All three providers supported**: OpenAI, Anthropic Claude, Google Gemini can all use tools
60+
- Tool toggle button in chat toolbar
61+
- Tool execution results expandable to view details
62+
- Supported tools:
63+
- `read_file` - Read file content
64+
- `write_file` - Write file content
65+
- `list_directory` - List directory files
66+
- `delete_file` - Delete file
67+
- `create_directory` - Create directory
68+
- `web_fetch` - Web page content fetching
69+
- `get_system_info` - Get device information
70+
71+
---
72+
73+
# v1.1
74+
75+
### New Features:
76+
- Streaming message output
77+
- Output content token upload/download/TPS (tokens per second)/first token latency display
78+
- Persistent data storage (now supports both API provider persistent storage and local conversation persistent storage)
79+
- Multi-conversation data reception optimization
80+
- Optimized conversation page display, supports model selection on conversation page instead of provider settings page
81+
- Provider multi-model support
82+
83+
---
84+
2885
# v1.0
2986

3087
### First Official Release!
@@ -50,16 +107,6 @@ The author of TChat is from mainland China. It's best to communicate in Simplifi
50107
- Output content TPS/token speed/tokens count display
51108
- Persistent data storage (currently only supports persistent storage for API provider services)
52109

53-
# v1.1
54-
55-
### New Features:
56-
- Streaming message output
57-
- Output content token upload/download/TPS (tokens per second)/first token latency display
58-
- Persistent data storage (now supports both API provider persistent storage and local conversation persistent storage)
59-
- Multi-conversation data reception optimization
60-
- Optimized conversation page display, supports model selection on conversation page instead of provider settings page
61-
- Provider multi-model support
62-
63110

64111

65112
## License

README_HK.md

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,63 @@ TChat嘅作者係大陸人,交流最好用簡體中文,如果唔識用就用
2525

2626

2727

28+
# v1.2
29+
30+
### 新增功能
31+
32+
- **服務商多模型管理**
33+
- 服務商設定支援從 API 攞模型列表
34+
- 攞完彈窗揀要儲存嘅模型(支援多選)
35+
- 已儲存模型可以單獨刪除
36+
- 支援手動添加自訂模型
37+
38+
- **聊天頁面模型選擇**
39+
- 喺聊天頁面輸入框上面工具欄揀模型
40+
-**Lucide Icon** 顯示模型類型圖示
41+
- OpenAI → ✨ Sparkles
42+
- Claude → 🤖 Bot
43+
- Gemini → 🧠 BrainCircuit
44+
45+
- **二維碼分享優化**
46+
- 用 ModalBottomSheet 樣式代替彈窗
47+
- 支援揀係咪包含模型列表
48+
- 顯示預計資料大小
49+
- 二維碼卡片顯示服務商名同端點
50+
51+
- **Material You 介面重構**
52+
- 服務商列表頁用 ElevatedCard 卡片設計
53+
- 服務商編輯頁用卡片分組佈局
54+
- 用 FAB 浮動按鈕代替底部固定按鈕
55+
- 刪除「設為當前使用」按鈕(簡化操作)
56+
57+
- **本地工具調用功能**
58+
- 支援 AI 調用本地工具完成任務
59+
- **三大提供商全支援**:OpenAI、Anthropic Claude、Google Gemini 都可以用工具
60+
- 聊天工具欄添加工具開關掣
61+
- 工具執行結果可以展開睇詳情
62+
- 支援嘅工具:
63+
- `read_file` - 讀取檔案內容
64+
- `write_file` - 寫入檔案內容
65+
- `list_directory` - 列出目錄檔案
66+
- `delete_file` - 刪除檔案
67+
- `create_directory` - 建立目錄
68+
- `web_fetch` - 網頁內容抓取
69+
- `get_system_info` - 攞裝置資訊
70+
71+
---
72+
73+
# v1.1
74+
75+
### 新增功能:
76+
- 串流式訊息輸出
77+
- 輸出內容token上行/下行/TPS(每秒token數)顯示/首字延時 顯示
78+
- 持久化資料儲存(而家支援API提供商嘅服務持久化儲存同本地對話持久化儲存)
79+
- 多對話資料接收優化
80+
- 優化對話頁面顯示,支援對話頁面揀模型而唔係設定提供商頁面設定對話模型
81+
- 支援提供商對多模型
82+
83+
---
84+
2885
# v1.0
2986

3087
### 首個正式版本發布!
@@ -50,16 +107,6 @@ TChat嘅作者係大陸人,交流最好用簡體中文,如果唔識用就用
50107
- 輸出內容TPS/token速度/tokens數量顯示
51108
- 持久化資料儲存(目前淨係支援API提供商嘅服務持久化儲存)
52109

53-
# v1.1
54-
55-
### 新增功能:
56-
- 串流式訊息輸出
57-
- 輸出內容token上行/下行/TPS(每秒token數)顯示/首字延時 顯示
58-
- 持久化資料儲存(而家支援API提供商嘅服務持久化儲存同本地對話持久化儲存)
59-
- 多對話資料接收優化
60-
- 優化對話頁面顯示,支援對話頁面揀模型而唔係設定提供商頁面設定對話模型
61-
- 支援提供商對多模型
62-
63110

64111

65112
## 授權條款

0 commit comments

Comments
 (0)