qing-client 0.0.50 → 0.0.52
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.
- package/README.MD +168 -8
- package/lib/service/EzAbilityService.d.ts +11 -1
- package/lib/service/EzAbilityService.js +16 -0
- package/lib/types/ez-ability.d.ts +10 -0
- package/package.json +1 -1
package/README.MD
CHANGED
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
`qing-client` 是一个统一的 JavaScript / TypeScript SDK,用于访问 Qing 平台提供的各类服务能力,包括:
|
|
4
4
|
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* AI / AIGC
|
|
8
|
-
*
|
|
5
|
+
* **用户与认证**(auth、user、token)
|
|
6
|
+
* **消息中心**(msg)
|
|
7
|
+
* **AI / AIGC 能力**(ai、aigc)
|
|
8
|
+
* **文件服务**(file,可独立使用 `FileService`)
|
|
9
|
+
* **审计日志**(audit)
|
|
10
|
+
* **提供商与用量**(provider、usage)
|
|
11
|
+
* **组织与多租户**(org)
|
|
12
|
+
* **投递流与 Ez 能力**(deliveryStream、ezAbility)
|
|
13
|
+
* **静态 HTML 托管**(gateway-h5,frontHost)
|
|
9
14
|
|
|
10
15
|
该 SDK 为 **公开 npm 包**,任何 **拥有合法账号的第三方开发者** 均可使用。
|
|
11
16
|
|
|
@@ -15,13 +20,37 @@
|
|
|
15
20
|
|
|
16
21
|
* 前后端统一 SDK
|
|
17
22
|
* 支持 浏览器 / H5 / 移动端 / Node.js
|
|
18
|
-
*
|
|
19
|
-
*
|
|
23
|
+
* 自动处理认证与请求头(含项目 / 组织 / 应用多租户头)
|
|
24
|
+
* 支持多服务调用(统一 `Client` 或按需使用独立 Service)
|
|
20
25
|
* 完整 TypeScript 类型定义
|
|
21
26
|
* 支持静态前端托管管理(上传 zip)
|
|
22
27
|
|
|
23
28
|
---
|
|
24
29
|
|
|
30
|
+
## 如何查看每个函数的入参与返回值
|
|
31
|
+
|
|
32
|
+
本 SDK 是**黑盒**使用时,可通过以下方式获知“怎么调、要传什么、会返回什么”:
|
|
33
|
+
|
|
34
|
+
1. **TypeScript / IDE 类型提示**
|
|
35
|
+
安装后,在支持 TypeScript 或 JSDoc 的项目中,编辑器会对所有方法做**参数和返回值**的自动补全与说明。每个方法的入参、返回类型都有定义。
|
|
36
|
+
|
|
37
|
+
2. **类型均从包内导出**
|
|
38
|
+
所有请求体/响应体的类型都可从 `qing-client` 直接导入,便于在业务代码里写类型、查看字段:
|
|
39
|
+
```ts
|
|
40
|
+
import type {
|
|
41
|
+
LoginCredentials, LoginResponse, RegisterRequest,
|
|
42
|
+
User, UserCreateRequest, Message, MessageQueryParams, CreateMessageRequest,
|
|
43
|
+
ChatCompletionRequest, ChatCompletionResponse, CreateSessionRequest, SessionDetailResponse,
|
|
44
|
+
FrontHostCreateProjectInput, FrontHostProject
|
|
45
|
+
} from "qing-client";
|
|
46
|
+
```
|
|
47
|
+
在 IDE 中跳转到这些类型即可看到**完整字段说明**。
|
|
48
|
+
|
|
49
|
+
3. **下文「API 参考」**
|
|
50
|
+
对最常用方法做了简要说明:方法名、入参、返回值及主要字段,便于快速查阅。
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
25
54
|
## 安装
|
|
26
55
|
|
|
27
56
|
```bash
|
|
@@ -74,6 +103,7 @@ const client = new Client({
|
|
|
74
103
|
gatewayUrl: "https://api.example.com",
|
|
75
104
|
projectId: "your-project-id",
|
|
76
105
|
appId: "your-app-id",
|
|
106
|
+
orgId: "your-org-id", // 可选,组织维度
|
|
77
107
|
});
|
|
78
108
|
```
|
|
79
109
|
|
|
@@ -88,6 +118,9 @@ SDK 会自动为所有请求附加:
|
|
|
88
118
|
* `Authorization: Bearer <token>`
|
|
89
119
|
* `x-project-id`
|
|
90
120
|
* `x-app-id`
|
|
121
|
+
* `x-org-id`(若配置了 `orgId`)
|
|
122
|
+
|
|
123
|
+
前端模式下还可使用:`client.setProjectAndApp(projectId, appId)`、`client.setOrgId(orgId)`、`client.setProjectOrgApp(projectId, orgId, appId)`。
|
|
91
124
|
|
|
92
125
|
---
|
|
93
126
|
|
|
@@ -98,23 +131,149 @@ import { Client } from "qing-client";
|
|
|
98
131
|
|
|
99
132
|
const client = new Client({
|
|
100
133
|
authServiceUrl: "http://auth-service",
|
|
134
|
+
msgServiceUrl: "http://msg-service",
|
|
101
135
|
userServiceUrl: "http://user-service",
|
|
136
|
+
fileServiceUrl: "http://file-service",
|
|
137
|
+
tokenServiceUrl: "http://token-service",
|
|
138
|
+
aigcServiceUrl: "http://aigc-service",
|
|
139
|
+
auditLogServiceUrl: "http://audit-log-service",
|
|
140
|
+
providerServiceUrl: "http://provider-service",
|
|
141
|
+
orgServiceUrl: "http://org-service",
|
|
102
142
|
gatewayH5ServiceUrl: "http://gateway-h5-service",
|
|
143
|
+
deliveryStreamServiceUrl: "http://delivery-stream-service",
|
|
144
|
+
ezAbilityServiceUrl: "http://ez-ability-service",
|
|
103
145
|
});
|
|
104
146
|
```
|
|
105
147
|
|
|
148
|
+
按需配置实际用到的服务地址即可,未用到的可省略。
|
|
149
|
+
|
|
106
150
|
### 设置用户上下文(仅后端模式)
|
|
107
151
|
|
|
108
152
|
```ts
|
|
109
153
|
client.setUserContext({
|
|
110
154
|
userId: "123",
|
|
111
|
-
role: "ADMIN",
|
|
155
|
+
role: "ADMIN", // SUPER_ADMIN | ADMIN | STAFF | USER | SYSTEM
|
|
112
156
|
projectId: "project-1",
|
|
157
|
+
orgId: "org-1", // 可选
|
|
158
|
+
appId: "app-1", // 可选
|
|
113
159
|
});
|
|
114
160
|
```
|
|
115
161
|
|
|
116
162
|
---
|
|
117
163
|
|
|
164
|
+
## Client 上的服务
|
|
165
|
+
|
|
166
|
+
通过 `Client` 实例可访问以下服务(均为同一配置与 Token):
|
|
167
|
+
|
|
168
|
+
| 属性 | 说明 |
|
|
169
|
+
|------|------|
|
|
170
|
+
| `client.auth` | 认证与登录 |
|
|
171
|
+
| `client.user` | 用户信息 |
|
|
172
|
+
| `client.token` | Token 管理 |
|
|
173
|
+
| `client.msg` | 消息中心 |
|
|
174
|
+
| `client.ai` | AI 对话/会话(chatCompletion、会话与助手等) |
|
|
175
|
+
| `client.aigc` | AIGC 能力 |
|
|
176
|
+
| `client.audit` | 审计日志 |
|
|
177
|
+
| `client.provider` | 提供商与模型 |
|
|
178
|
+
| `client.usage` | 用量统计 |
|
|
179
|
+
| `client.org` | 组织与多租户 |
|
|
180
|
+
| `client.frontHost` | 静态 HTML 托管(gateway-h5) |
|
|
181
|
+
| `client.deliveryStream` | 投递流 |
|
|
182
|
+
| `client.ezAbility` | Ez 能力 |
|
|
183
|
+
|
|
184
|
+
文件服务需单独使用:`import { FileService } from "qing-client"`,并传入与前端/后端一致的配置。
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## API 参考(主要方法)
|
|
189
|
+
|
|
190
|
+
以下列出各服务**常用方法**的入参与返回值,便于在不看源码的情况下正确调用。未列出的方法可在安装后通过 IDE 查看方法签名,或查看包内类型定义(如 `lib/types/*.d.ts`)。
|
|
191
|
+
|
|
192
|
+
**说明**:所有方法最后一个参数均为可选的 `options?: RequestOptions`(可传 `projectId` / `orgId` / `appId` 等覆盖本次请求的上下文),下文省略不写。
|
|
193
|
+
|
|
194
|
+
### client.auth(认证)
|
|
195
|
+
|
|
196
|
+
| 方法 | 入参 | 返回值 | 说明 |
|
|
197
|
+
|------|------|--------|------|
|
|
198
|
+
| `login(identifier, password, projectId?, options?)` | `identifier`: string(用户名/邮箱)<br>`password`: string<br>`projectId?`: number,默认 0 | `Promise<LoginResponse>` | 表单登录(旧版)。`LoginResponse` 含 `access_token`、`token_type`、`expires_at`、`project_id`、`org_id?`、`app_id?`。 |
|
|
199
|
+
| `loginJson(credentials, projectId?, options?)` | `credentials`: `LoginCredentials`(`username`, `password`, `org_id?`, `app_id?`)<br>`projectId?`: number | `Promise<LoginResponse>` | 推荐:JSON 登录,支持组织/应用。 |
|
|
200
|
+
| `wechatMiniProgramLogin(credentials, projectId?, options?)` | `credentials`: `WechatLoginCredentials`(`code`, `phone_code?`, `org_id?`, `app_id?`) | `Promise<LoginResponse>` | 微信小程序登录。 |
|
|
201
|
+
| `register(data, projectId?, options?)` | `data`: `RegisterRequest`(`username`, `email`, `password`, `name?`, `phone?`, `org_id?`, `app_id?`) | `Promise<RegisterResponse>` | 注册,返回同登录结构。 |
|
|
202
|
+
| `createTemporaryToken(request?, options?)` | `request?`: `TemporaryTokenRequest`(`expires_in?`,秒,60–3600) | `Promise<TemporaryTokenResponse>`:`temporary_token`, `expires_at`, `expires_in` | 签发临时令牌。 |
|
|
203
|
+
| `verifyTemporaryToken(request, options?)` | `request`: `VerifyTemporaryTokenRequest` | `Promise<VerifyTemporaryTokenResponse>` | 验证临时令牌。 |
|
|
204
|
+
| `logout(token, options?)` | `token`: string | `Promise<void>` | 登出。 |
|
|
205
|
+
|
|
206
|
+
### client.user(用户)
|
|
207
|
+
|
|
208
|
+
| 方法 | 入参 | 返回值 | 说明 |
|
|
209
|
+
|------|------|--------|------|
|
|
210
|
+
| `getCurrentUser(options?)` | — | `Promise<User>` | 当前用户。`User` 含 `id`, `username`, `email`, `name`, `avatar`, `phone`, `role`, `project_id`, `is_active`, `organizations?` 等。 |
|
|
211
|
+
| `getUserById(userId, options?)` | `userId`: number | `Promise<User>` | 按 ID 查用户(管理员)。 |
|
|
212
|
+
| `createUser(userData, options?)` | `userData`: `UserCreateRequest`(`username`, `email`, `password`, `name?`, `role?`, `phone?`, `project_id?`) | `Promise<User>` | 创建用户(管理员)。 |
|
|
213
|
+
| `updateUser(userId, updateData, options?)` | `userId`: number<br>`updateData`: `UserUpdateRequest`(`name?`, `avatar?`, `phone?`, `role?`, `project_id?`) | `Promise<User>` | 更新用户(管理员)。 |
|
|
214
|
+
| `listUsers(includeInactive?, page?, perPage?, projectId?, options?)` | `includeInactive?`: boolean<br>`page?`: number<br>`perPage?`: number<br>`projectId?`: number | `Promise<PaginatedResponse<User>>`(`data`, `pagination`) | 用户列表,支持分页与项目过滤。 |
|
|
215
|
+
| `updateCurrentUser(updateData, options?)` | `updateData`: `SelfUserUpdateRequest`(`name?`, `avatar?`, `phone?`) | `Promise<User>` | 更新当前用户资料。 |
|
|
216
|
+
| `changeOwnPassword(passwordData, options?)` | `passwordData`: `SelfPasswordChangeRequest`(`old_password`, `new_password`) | `Promise<{ id: number }>` | 修改当前用户密码。 |
|
|
217
|
+
|
|
218
|
+
### client.msg(消息)
|
|
219
|
+
|
|
220
|
+
| 方法 | 入参 | 返回值 | 说明 |
|
|
221
|
+
|------|------|--------|------|
|
|
222
|
+
| `getMessages(params?, options?)` | `params?`: `MessageQueryParams`(`type?`, `category?`, `isRead?`, `page?`, `limit?`, `userId?`, `pid?`, `aid?`) | `Promise<Message[]>` | 当前用户消息列表。`Message` 含 `_id`, `userId`, `title`, `content`, `type`, `category`, `isRead`, `readAt?`, `createdAt`, `updatedAt` 等。 |
|
|
223
|
+
| `getUnreadStats(userId?, options?)` | `userId?`: string(管理员可指定) | `Promise<MessageStats>`:`total`, `byCategory` | 未读统计。 |
|
|
224
|
+
| `markAsRead(messageId, request?, options?)` | `messageId`: string<br>`request?`: `MarkAsReadRequest` | `Promise<Message>` | 单条标已读。 |
|
|
225
|
+
| `markManyAsRead(request, options?)` | `request`: `BatchMarkAsReadRequest`(如 `messageIds`) | `Promise<{ modifiedCount: number }>` | 批量标已读。 |
|
|
226
|
+
| `createMessage(request, options?)` | `request`: `CreateMessageRequest`(`userId?`, `title`, `content`, `type`, `category`, `metadata?`) | `Promise<Message>` | 创建消息(管理员)。 |
|
|
227
|
+
| `sendMail(request, options?)` | `request`: `MailRequest`(`to`, `subject?`, `text?`, `html?`, `cc?`, `bcc?`, `attachments?` 等) | `Promise<void>` | 发送邮件。 |
|
|
228
|
+
| `sendFeishuMessage(message, options?)` | `message`: `FeishuMessage`(`url`, `title?`, `elements`, `noticeUser?`, `actions?`) | `Promise<void>` | 发送飞书消息。 |
|
|
229
|
+
|
|
230
|
+
### client.ai(AI 对话与会话)
|
|
231
|
+
|
|
232
|
+
| 方法 | 入参 | 返回值 | 说明 |
|
|
233
|
+
|------|------|--------|------|
|
|
234
|
+
| `chatCompletion(request, options?)` | `request`: `ChatCompletionRequest`(`sessionId`, `message`, `model?`) | `Promise<ChatCompletionResponse>`:`success`, `message`, `data.message`, `data.sessionId` | 单次对话(非流式)。 |
|
|
235
|
+
| `chatCompletionStream(request, options?)` | 同上 | `Promise<ChatCompletionResponse>` | 流式对话。 |
|
|
236
|
+
| `createSession(request, options?)` | `request`: `CreateSessionRequest`(见类型定义) | `Promise<SessionDetailResponse>` | 创建会话。 |
|
|
237
|
+
| `getSessions(params?, options?)` | `params?`: `{ page?, limit?, status? }`,`status` 为 `'active' \| 'ended'` | `Promise<SessionListResponse>` | 会话列表。 |
|
|
238
|
+
| `getSession(sessionId, options?)` | `sessionId`: string | `Promise<SessionDetailResponse>` | 会话详情。 |
|
|
239
|
+
| `getSessionMessages(sessionId, params?, options?)` | `sessionId`: string<br>`params?`: `{ page?, limit? }` | `Promise<PaginatedSessionMessageResponse>` | 会话消息列表。 |
|
|
240
|
+
| `addMessageToSession(sessionId, request, options?)` | `sessionId`: string<br>`request`: `AddMessageRequest` | `Promise<SessionDetailResponse>` | 向会话追加消息。 |
|
|
241
|
+
| `getAssistants(params?, options?)` | `params?`: `{ page?, limit? }` | `Promise<AssistantListResponse>` | 助手列表。 |
|
|
242
|
+
| `getAssistant(assistantId, options?)` | `assistantId`: string | `Promise<AssistantResponse>` | 助手详情。 |
|
|
243
|
+
| `createAssistant(request, options?)` | `request`: `CreateAssistantRequest` | `Promise<AssistantResponse>` | 创建助手。 |
|
|
244
|
+
| `getModels(params?, options?)` | `params?`: `{ provider?, capability? }` | `Promise<{ models: ModelListItem[] }>` | 模型列表。 |
|
|
245
|
+
| `getModel(modelId, options?)` | `modelId`: string | `Promise<ModelDetail>` | 模型详情。 |
|
|
246
|
+
|
|
247
|
+
### client.frontHost(静态 HTML 托管)
|
|
248
|
+
|
|
249
|
+
| 方法 | 入参 | 返回值 | 说明 |
|
|
250
|
+
|------|------|--------|------|
|
|
251
|
+
| `listProjects(options?)` | — | `Promise<PaginatedResponse<FrontHostProject>>` | 托管项目列表。 |
|
|
252
|
+
| `getProject(id, options?)` | `id`: string | `Promise<FrontHostProject>`:`id`, `name`, `domain`, `url`, `deployType`, `routePath`, `status` 等。 | 项目详情。 |
|
|
253
|
+
| `createProject(input, options?)` | `input`: `FrontHostCreateProjectInput`(**必填** `deployType`, `file`;可选 `name`, `subdomain`, `domain`, `routePath`, `proxyDomain`)<br>`deployType`: `'subdomain' \| 'route' \| 'proxy' \| 'file'` | `Promise<FrontHostProject>` | 创建托管项目并上传 zip/文件。 |
|
|
254
|
+
| `deployNewVersion(projectId, file, options?)` | `projectId`: string<br>`file`: Blob \| File(zip) | `Promise<FrontHostDeployResponse>`:`version`, `project` | 部署新版本。 |
|
|
255
|
+
| `getProjectVersions(projectId, options?)` | `projectId`: string | `Promise<FrontHostProjectVersion[]>` | 项目版本列表。 |
|
|
256
|
+
| `rollbackVersion(projectId, versionId, options?)` | `projectId`: string<br>`versionId`: string | `Promise<FrontHostDeployResponse>` | 回滚到指定版本。 |
|
|
257
|
+
| `deleteProject(id, options?)` | `id`: string | `Promise<void>` | 删除项目。 |
|
|
258
|
+
|
|
259
|
+
### 其他服务(类型即文档)
|
|
260
|
+
|
|
261
|
+
以下服务方法较多,**入参与返回值均以包内 TypeScript 类型为准**,在 IDE 中查看对应 Service 的方法列表即可看到完整签名:
|
|
262
|
+
|
|
263
|
+
- **client.token**:Token 管理。
|
|
264
|
+
- **client.aigc**:AIGC 能力。
|
|
265
|
+
- **client.audit**:`listAuditLogs(query?)` 等,入参见 `AuditLogListQuery`。
|
|
266
|
+
- **client.provider**:`listProviders`、`getProvider`、`listProviderModels`、`listGlobalModels`、`chatCompletions` 等,请求/响应见 `provider`、`ai` 类型。
|
|
267
|
+
- **client.usage**:`summary`、`daily`、`byModel`、`byProvider`、`byUser`、`top`,入参见 `UsageBaseQuery`、`UsageDailyQuery` 等。
|
|
268
|
+
- **client.org**:组织/项目/应用 CRUD、解析等,见 `OrgService` 与 `types/org`。
|
|
269
|
+
- **client.deliveryStream**:投递流、版本、需求等,见 `DeliveryStreamService` 与 `types/delivery-stream`。
|
|
270
|
+
- **client.ezAbility**:需求枚举、PRD/MVPRD 生成、任务查询等,见 `EzAbilityService` 与 `types/ez-ability`。
|
|
271
|
+
- **FileService**(独立实例):`createFile`、`getFileById`、`listFiles`、`generateOSSUploadSign`、`getFolderTree`、`getDownloadUrl` 等,见 `FileService` 与 `types/file`。
|
|
272
|
+
|
|
273
|
+
安装后可在 `node_modules/qing-client/lib/` 下查看 `*.d.ts` 或直接在业务代码中通过 IDE 跳转到上述类型与方法。
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
118
277
|
## 用户与认证
|
|
119
278
|
|
|
120
279
|
### 登录
|
|
@@ -141,6 +300,7 @@ const messages = await client.msg.getMessages();
|
|
|
141
300
|
## AI / AIGC 示例
|
|
142
301
|
|
|
143
302
|
```ts
|
|
303
|
+
// AI 对话(client.ai)
|
|
144
304
|
const response = await client.ai.chatCompletion({
|
|
145
305
|
sessionId: "session-id",
|
|
146
306
|
message: "你好",
|
|
@@ -151,7 +311,7 @@ const response = await client.ai.chatCompletion({
|
|
|
151
311
|
|
|
152
312
|
## HTML 静态托管(gateway-h5)
|
|
153
313
|
|
|
154
|
-
SDK 提供了静态 HTML
|
|
314
|
+
SDK 提供了静态 HTML 托管管理能力,用于上传和管理前端站点。若已创建 `Client`,可直接使用 `client.frontHost`;也可单独 `import { FrontHostService } from "qing-client"` 并传入相同配置。
|
|
155
315
|
|
|
156
316
|
> ⚠️ **重要说明**
|
|
157
317
|
>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseClient } from "../client/BaseClient";
|
|
2
2
|
import { ClientConfig } from "../types";
|
|
3
|
-
import { EnumerateRequirementsRequest, EnumerateRequirementsResponse, GeneratePRDRequest, GeneratePRDResponse, GenerateMVPRDRequest, GenerateMVPRDResponse, TaskQueryResponse, GetTasksQuery, GetPRDTasksQuery, GetMVPRDTasksQuery, TaskListResponse } from "../types/ez-ability";
|
|
3
|
+
import { EnumerateRequirementsRequest, EnumerateRequirementsResponse, GeneratePRDRequest, GeneratePRDResponse, GenerateMVPRDRequest, GenerateMVPRDResponse, TaskQueryResponse, GetTasksQuery, GetPRDTasksQuery, GetMVPRDTasksQuery, TaskListResponse, NameRequirementRequest, NameRequirementResponse } from "../types/ez-ability";
|
|
4
4
|
/**
|
|
5
5
|
* EzAbility 服务 - AI 能力服务客户端
|
|
6
6
|
*
|
|
@@ -8,6 +8,7 @@ import { EnumerateRequirementsRequest, EnumerateRequirementsResponse, GeneratePR
|
|
|
8
8
|
* - 需求枚举(异步任务)
|
|
9
9
|
* - PRD生成(异步任务)
|
|
10
10
|
* - MVP PRD生成(异步任务)
|
|
11
|
+
* - 需求起名(同步接口)
|
|
11
12
|
* - 任务列表查询(支持分页和过滤)
|
|
12
13
|
* - 任务状态查询
|
|
13
14
|
* - 任务取消
|
|
@@ -111,6 +112,15 @@ export declare class EzAbilityService extends BaseClient {
|
|
|
111
112
|
cancelMVPRDTask(taskId: string): Promise<{
|
|
112
113
|
message: string;
|
|
113
114
|
}>;
|
|
115
|
+
/**
|
|
116
|
+
* 根据需求内容生成需求名称
|
|
117
|
+
*
|
|
118
|
+
* 同步接口,立即返回结果
|
|
119
|
+
*
|
|
120
|
+
* @param request 需求内容
|
|
121
|
+
* @returns 生成的需求名称
|
|
122
|
+
*/
|
|
123
|
+
nameRequirement(request: NameRequirementRequest): Promise<NameRequirementResponse>;
|
|
114
124
|
/**
|
|
115
125
|
* 获取任务列表
|
|
116
126
|
*
|
|
@@ -10,6 +10,7 @@ const BaseClient_1 = require("../client/BaseClient");
|
|
|
10
10
|
* - 需求枚举(异步任务)
|
|
11
11
|
* - PRD生成(异步任务)
|
|
12
12
|
* - MVP PRD生成(异步任务)
|
|
13
|
+
* - 需求起名(同步接口)
|
|
13
14
|
* - 任务列表查询(支持分页和过滤)
|
|
14
15
|
* - 任务状态查询
|
|
15
16
|
* - 任务取消
|
|
@@ -153,6 +154,21 @@ class EzAbilityService extends BaseClient_1.BaseClient {
|
|
|
153
154
|
async cancelMVPRDTask(taskId) {
|
|
154
155
|
return this.request(`/prd-mvp/tasks/${taskId}`, { method: "DELETE" });
|
|
155
156
|
}
|
|
157
|
+
// ==================== 需求起名 ====================
|
|
158
|
+
/**
|
|
159
|
+
* 根据需求内容生成需求名称
|
|
160
|
+
*
|
|
161
|
+
* 同步接口,立即返回结果
|
|
162
|
+
*
|
|
163
|
+
* @param request 需求内容
|
|
164
|
+
* @returns 生成的需求名称
|
|
165
|
+
*/
|
|
166
|
+
async nameRequirement(request) {
|
|
167
|
+
return this.request("/requirement-naming/name", {
|
|
168
|
+
method: "POST",
|
|
169
|
+
body: request,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
156
172
|
// ==================== 任务管理 ====================
|
|
157
173
|
/**
|
|
158
174
|
* 获取任务列表
|
|
@@ -185,6 +185,16 @@ export interface TaskListResponse {
|
|
|
185
185
|
hasMore: boolean;
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
|
+
export interface NameRequirementRequest {
|
|
189
|
+
/** 需求内容(至少10个字符) */
|
|
190
|
+
requirement: string;
|
|
191
|
+
/** 指定使用的模型(不传则使用服务默认模型) */
|
|
192
|
+
model?: string;
|
|
193
|
+
}
|
|
194
|
+
export interface NameRequirementResponse {
|
|
195
|
+
/** 生成的需求名称 */
|
|
196
|
+
name: string;
|
|
197
|
+
}
|
|
188
198
|
export interface AbilityCallRequest {
|
|
189
199
|
abilityId: string;
|
|
190
200
|
params: Record<string, any>;
|