Gathering detailed insights and metrics for tianzhi-ai-sdk
Gathering detailed insights and metrics for tianzhi-ai-sdk
Gathering detailed insights and metrics for tianzhi-ai-sdk
Gathering detailed insights and metrics for tianzhi-ai-sdk
npm install tianzhi-ai-sdk
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
10
1
一个仿DeepSeek风格的AI聊天SDK,基于Vue3+Vite构建,支持多种AI模型和功能。
1npm install
1npm run dev
1npm run build
1<template> 2 <TianzhiAIChat 3 :base-url="baseUrl" 4 :oss-upload-url="ossUploadUrl" 5 :authorization="authorization" 6 /> 7</template> 8 9<script setup> 10import TianzhiAIChat from './components/TianzhiAIChat.vue' 11 12const baseUrl = 'http://your-api-server.com' 13const ossUploadUrl = 'https://your-oss-upload-url.com/upload' 14const authorization = 'your-auth-token' 15</script>
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
baseUrl | String | 是 | API服务器地址 |
ossUploadUrl | String | 是 | 阿里云OSS上传地址 |
authorization | String | 是 | 认证令牌 |
POST /chat/completions
请求参数:
1{ 2 "maskId": 0, 3 "message": "string", 4 "messageId": 0, 5 "model": "gpt-4o-mini", 6 "reasonEnabled": false, 7 "searchEnabled": false 8}
请求头:
Authorization: kuzumasatou
响应格式(流式):
data:{"t":"c","v":"AI回复内容"}
data:{"t":"r","v":"深度思考内容"}
GET /chat/models
响应格式:
1{ 2 "list": [ 3 { 4 "abilities": [...], 5 "description": {...}, 6 "modelCode": [...], 7 "provider": [...] 8 } 9 ] 10}
src/
├── components/ # 组件目录
│ ├── TianzhiAIChat.vue # 主聊天组件
│ └── MaskModal.vue # 面具选择弹窗
├── stores/ # 状态管理
│ └── chat.js # 聊天状态store
├── services/ # 服务层
│ └── api.js # API服务
├── utils/ # 工具函数
│ └── index.js # 通用工具函数
├── App.vue # 根组件
├── main.js # 入口文件
└── style.css # 全局样式
src/components/
目录下创建新组件src/stores/
目录下添加状态管理src/services/
目录下添加API服务src/utils/
目录下添加工具函数本项目支持两种构建模式,分别用于不同的使用场景:
build
命令1npm run build
src/main.js
createApp(App)
和 app.mount('#app')
)tianzhi-ai-sdk.js
vue
, vue-router
build:lib
命令1npm run build:lib
src/lib.js
TianzhiAIPlugin
)es
、umd
、cjs
tianzhi-ai-sdk.es.js
、tianzhi-ai-sdk.umd.js
、tianzhi-ai-sdk.cjs.js
vue
、highlight.js
tianzhi-ai-sdk.css
特性 | build | build:lib |
---|---|---|
目标用途 | 完整应用构建 | 库文件构建 |
入口文件 | main.js | lib.js |
输出格式 | 单一文件 | 多种格式 (ES/UMD/CJS) |
应用初始化 | 包含 | 不包含 |
插件支持 | 无 | 提供 Vue 插件 |
依赖处理 | 外部化 vue, vue-router | 外部化 vue, highlight.js |
CSS 处理 | 默认 | 单独输出 CSS 文件 |
build:lib
: 构建供其他项目使用的 SDK 库build
: 构建完整的演示应用或开发环境1# 构建库文件(推荐) 2npm run build:lib 3 4# 或构建完整应用 5npm run build
构建后的文件位于 dist/
目录。
MIT License
如有问题或建议,请提交 Issue 或联系开发团队。
1# 发布补丁版本 (1.2.0 -> 1.2.1) 2npm run publish:patch 3 4# 发布次要版本 (1.2.0 -> 1.3.0) 5npm run publish:minor 6 7# 发布主要版本 (1.2.0 -> 2.0.0) 8npm run publish:major
1# 给脚本执行权限 2chmod +x scripts/publish.sh 3 4# 发布补丁版本 5./scripts/publish.sh patch 6 7# 发布次要版本 8./scripts/publish.sh minor 9 10# 发布主要版本 11./scripts/publish.sh major 12 13# 查看帮助 14./scripts/publish.sh help
1# 发布补丁版本 2scripts\publish.bat patch 3 4# 发布次要版本 5scripts\publish.bat minor 6 7# 发布主要版本 8scripts\publish.bat major
1# 检查发布配置 2npm run check-publish 3 4# 构建项目 5npm run build 6 7# 检查 npm 登录状态 8npm whoami
发布脚本会自动执行以下步骤:
npm run build
)npm login
npm run check-publish
检查配置No vulnerabilities found.
No security vulnerabilities found.