@ayoxx/kundex 2.0.4 → 2.0.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/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/sdk.ts +14 -14
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/sdk.ts
CHANGED
|
@@ -133,7 +133,7 @@ export class Kundex {
|
|
|
133
133
|
|
|
134
134
|
models = {
|
|
135
135
|
list: async (): Promise<ModelInfo[]> => {
|
|
136
|
-
const res = await fetch(`${this.baseUrl}/v1/models`, {
|
|
136
|
+
const res = await fetch(`${this.baseUrl}/api/v1/models`, {
|
|
137
137
|
headers: { authorization: `Bearer ${this.apiKey}` },
|
|
138
138
|
});
|
|
139
139
|
if (!res.ok) throw new Error(`Kundex API error (${res.status})`);
|
|
@@ -155,7 +155,7 @@ export class Kundex {
|
|
|
155
155
|
message: KundexChatMessage;
|
|
156
156
|
finishReason: string;
|
|
157
157
|
usage: ChatUsage;
|
|
158
|
-
}>("/v1/chat/completions", { ...params, stream: false }),
|
|
158
|
+
}>("/api/v1/chat/completions", { ...params, stream: false }),
|
|
159
159
|
|
|
160
160
|
/** Streaming chat completion; invokes onDelta as tokens arrive. */
|
|
161
161
|
stream: async (
|
|
@@ -168,7 +168,7 @@ export class Kundex {
|
|
|
168
168
|
onDelta: (text: string) => void,
|
|
169
169
|
signal?: AbortSignal,
|
|
170
170
|
): Promise<{ finishReason: string; usage: ChatUsage | null }> => {
|
|
171
|
-
const res = await fetch(`${this.baseUrl}/v1/chat/completions`, {
|
|
171
|
+
const res = await fetch(`${this.baseUrl}/api/v1/chat/completions`, {
|
|
172
172
|
method: "POST",
|
|
173
173
|
headers: {
|
|
174
174
|
"content-type": "application/json",
|
|
@@ -229,19 +229,19 @@ export class Kundex {
|
|
|
229
229
|
description?: string;
|
|
230
230
|
language?: string;
|
|
231
231
|
}) =>
|
|
232
|
-
this.request<AgentSession>("/v1/agent/session", params),
|
|
232
|
+
this.request<AgentSession>("/api/v1/agent/session", params),
|
|
233
233
|
|
|
234
234
|
listSessions: () =>
|
|
235
|
-
this.requestGet<AgentSession[]>("/v1/agent/sessions"),
|
|
235
|
+
this.requestGet<AgentSession[]>("/api/v1/agent/sessions"),
|
|
236
236
|
|
|
237
237
|
getSession: (id: number) =>
|
|
238
|
-
this.requestGet<AgentSession>(`/v1/agent/sessions/${id}`),
|
|
238
|
+
this.requestGet<AgentSession>(`/api/v1/agent/sessions/${id}`),
|
|
239
239
|
|
|
240
240
|
deleteSession: (id: number) =>
|
|
241
|
-
this.requestDelete(`/v1/agent/sessions/${id}`),
|
|
241
|
+
this.requestDelete(`/api/v1/agent/sessions/${id}`),
|
|
242
242
|
|
|
243
243
|
getMessages: (id: number) =>
|
|
244
|
-
this.requestGet<{ sessionId: number; messages: unknown[] }>(`/v1/agent/sessions/${id}/messages`),
|
|
244
|
+
this.requestGet<{ sessionId: number; messages: unknown[] }>(`/api/v1/agent/sessions/${id}/messages`),
|
|
245
245
|
|
|
246
246
|
/**
|
|
247
247
|
* Send a message to the agent and stream the response.
|
|
@@ -266,7 +266,7 @@ export class Kundex {
|
|
|
266
266
|
onDelta: (text: string) => void,
|
|
267
267
|
signal?: AbortSignal,
|
|
268
268
|
): Promise<AgentTurn> => {
|
|
269
|
-
const endpoint = "/v1/agent/message";
|
|
269
|
+
const endpoint = "/api/v1/agent/message";
|
|
270
270
|
const res = await fetch(`${this.baseUrl}${endpoint}`, {
|
|
271
271
|
method: "POST",
|
|
272
272
|
headers: {
|
|
@@ -365,7 +365,7 @@ export class Kundex {
|
|
|
365
365
|
onDelta: (text: string) => void,
|
|
366
366
|
signal?: AbortSignal,
|
|
367
367
|
): Promise<AgentTurn> => {
|
|
368
|
-
const res = await fetch(`${this.baseUrl}/v1/agent/tool-result`, {
|
|
368
|
+
const res = await fetch(`${this.baseUrl}/api/v1/agent/tool-result`, {
|
|
369
369
|
method: "POST",
|
|
370
370
|
headers: {
|
|
371
371
|
"content-type": "application/json",
|
|
@@ -447,17 +447,17 @@ export class Kundex {
|
|
|
447
447
|
|
|
448
448
|
files = {
|
|
449
449
|
list: (wsId: number) =>
|
|
450
|
-
this.requestGet<{ files: WorkspaceFile[] }>(`/v1/workspace/${wsId}/files`),
|
|
450
|
+
this.requestGet<{ files: WorkspaceFile[] }>(`/api/v1/workspace/${wsId}/files`),
|
|
451
451
|
|
|
452
452
|
get: (wsId: number, path: string) =>
|
|
453
453
|
this.requestGet<WorkspaceFile>(
|
|
454
|
-
`/v1/workspace/${wsId}/files/content?path=${encodeURIComponent(path)}`,
|
|
454
|
+
`/api/v1/workspace/${wsId}/files/content?path=${encodeURIComponent(path)}`,
|
|
455
455
|
),
|
|
456
456
|
|
|
457
457
|
upsert: (wsId: number, params: { path: string; name: string; content: string; mimeType?: string }) =>
|
|
458
|
-
this.request<{ file: WorkspaceFile }>(`/v1/workspace/${wsId}/files`, params),
|
|
458
|
+
this.request<{ file: WorkspaceFile }>(`/api/v1/workspace/${wsId}/files`, params),
|
|
459
459
|
|
|
460
460
|
delete: (wsId: number, path: string) =>
|
|
461
|
-
this.requestDelete(`/v1/workspace/${wsId}/files?path=${encodeURIComponent(path)}`),
|
|
461
|
+
this.requestDelete(`/api/v1/workspace/${wsId}/files?path=${encodeURIComponent(path)}`),
|
|
462
462
|
};
|
|
463
463
|
}
|