@dotbots-boutique/server-sdk 0.1.0 → 0.2.0
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/client.d.ts +1 -1
- package/dist/client.js +6 -2
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class DotBotsBackend {
|
|
|
7
7
|
private proxyUrl;
|
|
8
8
|
constructor(config: DotBotsBackendConfig);
|
|
9
9
|
initialize(): Promise<void>;
|
|
10
|
-
ai(feature: string, request: BackendAiRequest): Promise<AiResponse>;
|
|
10
|
+
ai(feature: string, request: BackendAiRequest, onDelta?: (delta: string) => void): Promise<AiResponse>;
|
|
11
11
|
aiStream(feature: string, request: BackendAiRequest, onDelta: (delta: string) => void, onDone?: (response: AiResponse) => void): Promise<void>;
|
|
12
12
|
charge(featureCode: string, options: {
|
|
13
13
|
paidBy?: 'org' | 'app';
|
package/dist/client.js
CHANGED
|
@@ -28,7 +28,12 @@ class DotBotsBackend {
|
|
|
28
28
|
message: `[DotBotsBackend] Proxy config loaded — proxyUrl: ${data.proxyUrl}`,
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
|
-
async ai(feature, request) {
|
|
31
|
+
async ai(feature, request, onDelta) {
|
|
32
|
+
if (onDelta !== undefined) {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
this.aiStream(feature, request, onDelta, resolve).catch(reject);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
32
37
|
const response = await fetch(`${this.getProxyUrl()}/ai/call`, {
|
|
33
38
|
method: 'POST',
|
|
34
39
|
headers: this.baseHeaders(),
|
|
@@ -38,7 +43,6 @@ class DotBotsBackend {
|
|
|
38
43
|
tools: request.tools,
|
|
39
44
|
stream: false,
|
|
40
45
|
maxTokens: request.maxTokens,
|
|
41
|
-
paidBy: request.paidBy,
|
|
42
46
|
orgId: request.orgId,
|
|
43
47
|
}),
|
|
44
48
|
});
|
package/package.json
CHANGED