@blueking/chat-helper 0.0.13-dev.2 → 0.0.13-dev.5
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/dist/http/index.d.ts +1 -0
- package/dist/http/module/index.d.ts +1 -0
- package/dist/http/module/session.d.ts +1 -0
- package/dist/http/module/session.ts.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/session/use-session.d.ts +1 -0
- package/dist/session/use-session.ts.js +5 -0
- package/package.json +1 -1
package/dist/http/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare const useHttp: (options: IUseChatHelperOptions) => {
|
|
|
39
39
|
uploadFile: (sessionCode: string, file: File, config?: import("./fetch").IRequestConfig) => Promise<import("..").ILegacyUploadFileResult>;
|
|
40
40
|
uploadPvFiles: (sessionCode: string, files: File[], config?: import("./fetch").IRequestConfig) => Promise<import("..").IPvFileUploadResult>;
|
|
41
41
|
getPvFileDownloadUrl: (sessionCode: string, path: string, options?: import("..").GetPvFileDownloadUrlOptions, config?: import("./fetch").IRequestConfig) => Promise<import("..").IPvFileDownloadUrlResult>;
|
|
42
|
+
deletePvFile: (sessionCode: string, path: string, config?: import("./fetch").IRequestConfig) => Promise<unknown>;
|
|
42
43
|
isResumeSession: (sessionCode: string, config?: import("./fetch").IRequestConfig) => Promise<boolean>;
|
|
43
44
|
};
|
|
44
45
|
message: {
|
|
@@ -34,6 +34,7 @@ export declare const useModule: (fetchClient: FetchClient) => {
|
|
|
34
34
|
uploadFile: (sessionCode: string, file: File, config?: import("../fetch").IRequestConfig) => Promise<import("../..").ILegacyUploadFileResult>;
|
|
35
35
|
uploadPvFiles: (sessionCode: string, files: File[], config?: import("../fetch").IRequestConfig) => Promise<import("../..").IPvFileUploadResult>;
|
|
36
36
|
getPvFileDownloadUrl: (sessionCode: string, path: string, options?: import("../..").GetPvFileDownloadUrlOptions, config?: import("../fetch").IRequestConfig) => Promise<import("../..").IPvFileDownloadUrlResult>;
|
|
37
|
+
deletePvFile: (sessionCode: string, path: string, config?: import("../fetch").IRequestConfig) => Promise<unknown>;
|
|
37
38
|
isResumeSession: (sessionCode: string, config?: import("../fetch").IRequestConfig) => Promise<boolean>;
|
|
38
39
|
};
|
|
39
40
|
message: {
|
|
@@ -30,5 +30,6 @@ export declare const useSession: (fetchClient: FetchClient) => {
|
|
|
30
30
|
uploadFile: (sessionCode: string, file: File, config?: IRequestConfig) => Promise<ILegacyUploadFileResult>;
|
|
31
31
|
uploadPvFiles: (sessionCode: string, files: File[], config?: IRequestConfig) => Promise<IPvFileUploadResult>;
|
|
32
32
|
getPvFileDownloadUrl: (sessionCode: string, path: string, options?: GetPvFileDownloadUrlOptions, config?: IRequestConfig) => Promise<IPvFileDownloadUrlResult>;
|
|
33
|
+
deletePvFile: (sessionCode: string, path: string, config?: IRequestConfig) => Promise<unknown>;
|
|
33
34
|
isResumeSession: (sessionCode: string, config?: IRequestConfig) => Promise<boolean>;
|
|
34
35
|
};
|
|
@@ -192,6 +192,12 @@ const DEFAULT_PV_FILE_DOWNLOAD_TIMEOUT = 20000;
|
|
|
192
192
|
timeout: (_config_timeout = config === null || config === void 0 ? void 0 : config.timeout) !== null && _config_timeout !== void 0 ? _config_timeout : timeout
|
|
193
193
|
}));
|
|
194
194
|
};
|
|
195
|
+
/**
|
|
196
|
+
* 删除会话 PV 文件(取消输入框未发送附件)。
|
|
197
|
+
* path 走 query,无 body;URLSearchParams 会自动编码,勿二次 encode。
|
|
198
|
+
*/ const deletePvFile = (sessionCode, path, config)=>fetchClient.delete(`session/${sessionCode}/pv_files/`, {
|
|
199
|
+
path
|
|
200
|
+
}, config);
|
|
195
201
|
// 轮询接口,判断是否可以继续聊天
|
|
196
202
|
const isResumeSession = (sessionCode, config)=>fetchClient.get(`session/${sessionCode}/is_resume/`, undefined, config);
|
|
197
203
|
return {
|
|
@@ -208,6 +214,7 @@ const DEFAULT_PV_FILE_DOWNLOAD_TIMEOUT = 20000;
|
|
|
208
214
|
uploadFile,
|
|
209
215
|
uploadPvFiles,
|
|
210
216
|
getPvFileDownloadUrl,
|
|
217
|
+
deletePvFile,
|
|
211
218
|
isResumeSession
|
|
212
219
|
};
|
|
213
220
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -9895,6 +9895,7 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
|
|
|
9895
9895
|
uploadFile: (sessionCode: string, file: File) => Promise<import("./session").IUploadFileResult | undefined>;
|
|
9896
9896
|
uploadFiles: (sessionCode: string, files: File[]) => Promise<import("./session").IUploadFileResult[]>;
|
|
9897
9897
|
getPvFileDownloadUrl: (sessionCode: string, path: string, options?: import("./session").GetPvFileDownloadUrlOptions) => Promise<import("./session").IPvFileDownloadUrlResult>;
|
|
9898
|
+
deletePvFile: (sessionCode: string, path: string) => Promise<unknown>;
|
|
9898
9899
|
reset: () => void;
|
|
9899
9900
|
};
|
|
9900
9901
|
message: {
|
|
@@ -13758,6 +13759,7 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
|
|
|
13758
13759
|
uploadFile: (sessionCode: string, file: File, config?: import("./http").IRequestConfig) => Promise<import("./session").ILegacyUploadFileResult>;
|
|
13759
13760
|
uploadPvFiles: (sessionCode: string, files: File[], config?: import("./http").IRequestConfig) => Promise<import("./session").IPvFileUploadResult>;
|
|
13760
13761
|
getPvFileDownloadUrl: (sessionCode: string, path: string, options?: import("./session").GetPvFileDownloadUrlOptions, config?: import("./http").IRequestConfig) => Promise<import("./session").IPvFileDownloadUrlResult>;
|
|
13762
|
+
deletePvFile: (sessionCode: string, path: string, config?: import("./http").IRequestConfig) => Promise<unknown>;
|
|
13761
13763
|
isResumeSession: (sessionCode: string, config?: import("./http").IRequestConfig) => Promise<boolean>;
|
|
13762
13764
|
};
|
|
13763
13765
|
message: {
|
|
@@ -7775,6 +7775,7 @@ export declare const useSession: (mediator: IMediatorModule) => {
|
|
|
7775
7775
|
uploadFile: (sessionCode: string, file: File) => Promise<IUploadFileResult | undefined>;
|
|
7776
7776
|
uploadFiles: (sessionCode: string, files: File[]) => Promise<IUploadFileResult[]>;
|
|
7777
7777
|
getPvFileDownloadUrl: (sessionCode: string, path: string, options?: GetPvFileDownloadUrlOptions) => Promise<import("./type").IPvFileDownloadUrlResult>;
|
|
7778
|
+
deletePvFile: (sessionCode: string, path: string) => Promise<unknown>;
|
|
7778
7779
|
reset: () => void;
|
|
7779
7780
|
};
|
|
7780
7781
|
export type ISessionModule = ReturnType<typeof useSession>;
|
|
@@ -374,6 +374,10 @@ import { isPvFileUploadSupported } from './pv-file-upload.ts.js';
|
|
|
374
374
|
var _mediator_http;
|
|
375
375
|
return (_mediator_http = mediator.http) === null || _mediator_http === void 0 ? void 0 : _mediator_http.session.getPvFileDownloadUrl(sessionCode, path, options);
|
|
376
376
|
};
|
|
377
|
+
/** 删除会话 PV 文件。path 为上传回包 id/path,勿二次 encode。 */ const deletePvFile = (sessionCode, path)=>{
|
|
378
|
+
var _mediator_http;
|
|
379
|
+
return (_mediator_http = mediator.http) === null || _mediator_http === void 0 ? void 0 : _mediator_http.session.deletePvFile(sessionCode, path);
|
|
380
|
+
};
|
|
377
381
|
/**
|
|
378
382
|
* 重置 session 模块状态
|
|
379
383
|
*/ const reset = ()=>{
|
|
@@ -419,6 +423,7 @@ import { isPvFileUploadSupported } from './pv-file-upload.ts.js';
|
|
|
419
423
|
uploadFile,
|
|
420
424
|
uploadFiles,
|
|
421
425
|
getPvFileDownloadUrl,
|
|
426
|
+
deletePvFile,
|
|
422
427
|
reset
|
|
423
428
|
};
|
|
424
429
|
};
|