@shaxpir/duiduidui-models 1.25.7 → 1.25.8
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/models/Chat.d.ts +3 -1
- package/dist/models/Chat.js +11 -0
- package/package.json +1 -1
package/dist/models/Chat.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ export interface ChatError {
|
|
|
82
82
|
export interface ChatCacheBreakpoints {
|
|
83
83
|
system_prompt?: CacheBreakpoint;
|
|
84
84
|
tools?: CacheBreakpoint;
|
|
85
|
+
auto?: CacheBreakpoint;
|
|
85
86
|
}
|
|
86
87
|
export interface ChatPayload {
|
|
87
88
|
title?: string;
|
|
@@ -135,7 +136,8 @@ export declare class Chat extends SharedContent {
|
|
|
135
136
|
* Set a cache breakpoint for the system prompt or tools at the conversation level.
|
|
136
137
|
* These record that the server is using prompt caching for API calls in this chat.
|
|
137
138
|
*/
|
|
138
|
-
setCacheBreakpoint(target: 'system_prompt' | 'tools', ttl: CacheTTL): void;
|
|
139
|
+
setCacheBreakpoint(target: 'system_prompt' | 'tools' | 'auto', ttl: CacheTTL): void;
|
|
140
|
+
removeCacheBreakpoint(target: 'system_prompt' | 'tools' | 'auto'): void;
|
|
139
141
|
get cacheBreakpoints(): ChatCacheBreakpoints | undefined;
|
|
140
142
|
clearExpiredBreakpoints(): void;
|
|
141
143
|
}
|
package/dist/models/Chat.js
CHANGED
|
@@ -234,6 +234,14 @@ class Chat extends SharedContent_1.SharedContent {
|
|
|
234
234
|
}
|
|
235
235
|
batch.commit();
|
|
236
236
|
}
|
|
237
|
+
removeCacheBreakpoint(target) {
|
|
238
|
+
this.checkDisposed('Chat.removeCacheBreakpoint');
|
|
239
|
+
if (!this.payload.cache_breakpoints?.[target])
|
|
240
|
+
return;
|
|
241
|
+
const batch = new Operation_1.BatchOperation(this);
|
|
242
|
+
batch.removeValueAtPath(['payload', 'cache_breakpoints', target]);
|
|
243
|
+
batch.commit();
|
|
244
|
+
}
|
|
237
245
|
get cacheBreakpoints() {
|
|
238
246
|
return this.payload?.cache_breakpoints;
|
|
239
247
|
}
|
|
@@ -257,6 +265,9 @@ class Chat extends SharedContent_1.SharedContent {
|
|
|
257
265
|
if (cb.tools && shaxpir_common_1.Time.isDateTimeBefore(cb.tools.expires_at, now)) {
|
|
258
266
|
batch.removeValueAtPath(['payload', 'cache_breakpoints', 'tools']);
|
|
259
267
|
}
|
|
268
|
+
if (cb.auto && shaxpir_common_1.Time.isDateTimeBefore(cb.auto.expires_at, now)) {
|
|
269
|
+
batch.removeValueAtPath(['payload', 'cache_breakpoints', 'auto']);
|
|
270
|
+
}
|
|
260
271
|
batch.commit();
|
|
261
272
|
}
|
|
262
273
|
}
|