agent-tool-chat 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +44 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # agent-tool-chat
2
+
3
+ 基于 **ToolPackage** 架构的 AI 对话插件,工具由宿主控制执行。基于 Vue 3 + Element Plus。
4
+
5
+ **版本:** 0.1.0
6
+
7
+ ## 安装
8
+
9
+ ```bash
10
+ npm install agent-tool-chat
11
+ ```
12
+
13
+ 需要同级依赖 `vue` (^3.4) 和 `element-plus` (^2.0)。
14
+
15
+ ## 快速开始
16
+
17
+ ```vue
18
+ <script setup>
19
+ import { useAgentChat, ChatPanel } from 'agent-tool-chat'
20
+ import 'agent-tool-chat/dist/style.css'
21
+
22
+ const chat = useAgentChat({
23
+ toolPackages: [myToolPackage],
24
+ onToolCall: async (call) => {
25
+ // 执行工具并返回结果
26
+ return { success: true, data: { /* ... */ } }
27
+ },
28
+ })
29
+ </script>
30
+
31
+ <template>
32
+ <ChatPanel :chat="chat" />
33
+ </template>
34
+ ```
35
+
36
+ ## 使用说明
37
+
38
+ 1. **定义工具包** — 创建 `ToolPackage` 对象,包含工具定义和可选的 Vue 渲染组件。
39
+ 2. **创建 `useAgentChat`** — 传入工具包和宿主执行工具的 `onToolCall` 回调。
40
+ 3. **渲染 `ChatPanel`** — 将返回的 `AgentChatAPI` 绑定到 `chat` prop。
41
+ 4. **文件上传** — `ChatInput` 支持文件选择,文件存入 `fileStore`,工具通过 `fileId` 引用。
42
+ 5. **持久化** — 消息和设置自动保存到 `localStorage`。
43
+
44
+ 详细架构文档见 [DESIGN.md](./DESIGN.md)。
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "agent-tool-chat",
3
3
  "description": "An agent-driven chat plugin with ToolPackage architecture and host-controlled execution",
4
4
  "author": "kangjinrui <1092014304@qq.com>",
5
- "version": "0.1.0",
5
+ "version": "0.1.1",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "./dist/index.cjs",