macrocosmos 1.2.21 → 1.2.22
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.
|
@@ -133,10 +133,39 @@ describe("ApexClient", () => {
|
|
|
133
133
|
// Verify the response structure
|
|
134
134
|
console.log("Stored chats:", get_chat_sessions_result);
|
|
135
135
|
expect(get_chat_sessions_result).toBeDefined();
|
|
136
|
-
//
|
|
136
|
+
// make sure the chat does not exist in the chats retrieved
|
|
137
137
|
expect(Array.isArray(get_chat_sessions_result.chatSessions)).toBe(true);
|
|
138
138
|
expect(get_chat_sessions_result.chatSessions.some(session => session.id === create_chat_result.parsedChat?.id)).toBe(false);
|
|
139
139
|
}, 30000);
|
|
140
|
+
it("should delete a completion", async () => {
|
|
141
|
+
// chat ID for testing
|
|
142
|
+
const create_completion_result = await client.createChatAndCompletion({
|
|
143
|
+
userPrompt: "This is a test chat, how is it going?",
|
|
144
|
+
chatType: "apex",
|
|
145
|
+
completionType: "basic",
|
|
146
|
+
title: "Test Chat",
|
|
147
|
+
});
|
|
148
|
+
console.log("Create completion response:", create_completion_result);
|
|
149
|
+
expect(create_completion_result).toBeDefined();
|
|
150
|
+
// Delete test completion
|
|
151
|
+
const delete_completion_result = await client.deleteCompletions({
|
|
152
|
+
completionIds: [create_completion_result.parsedCompletion?.id ?? ""],
|
|
153
|
+
});
|
|
154
|
+
expect(delete_completion_result).toBeDefined();
|
|
155
|
+
expect(delete_completion_result.success).toBeTruthy();
|
|
156
|
+
const get_chat_completions_result = await client.getStoredChatCompletions({
|
|
157
|
+
chatId: create_completion_result.parsedChat?.id ?? "",
|
|
158
|
+
});
|
|
159
|
+
console.log("Stored completions:", get_chat_completions_result);
|
|
160
|
+
expect(get_chat_completions_result).toBeDefined();
|
|
161
|
+
// make sure the completion does not exist in the chats retrieved
|
|
162
|
+
expect(get_chat_completions_result.chatCompletions.some(completion => completion.id === create_completion_result.parsedCompletion?.id)).toBe(false);
|
|
163
|
+
// Now delete test chat
|
|
164
|
+
const delete_chat_result = await client.deleteChats({
|
|
165
|
+
chatIds: [create_completion_result.parsedChat?.id ?? ""],
|
|
166
|
+
});
|
|
167
|
+
expect(delete_chat_result.success).toBeTruthy();
|
|
168
|
+
}, 30000);
|
|
140
169
|
// Deep Researcher Tests
|
|
141
170
|
it("should create a deep research job", async () => {
|
|
142
171
|
// Create test parameters
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApexServiceClient, ChatCompletionRequest as GeneratedChatCompletionRequest, ChatCompletionResponse, ChatCompletionChunkResponse, WebRetrievalRequest as GeneratedWebRetrievalRequest, WebRetrievalResponse, ChatMessage, SubmitDeepResearcherJobResponse, GetDeepResearcherJobRequest, GetDeepResearcherJobResponse, GetStoredChatCompletionsRequest, GetStoredChatCompletionsResponse, GetChatSessionsResponse, SearchChatIdsByPromptAndCompletionTextRequest, SearchChatIdsByPromptAndCompletionTextResponse, CreateChatAndCompletionRequest, CreateChatAndCompletionResponse, CreateCompletionRequest, CreateCompletionResponse, DeleteChatsRequest, DeleteChatsResponse } from "../../generated/apex/v1/apex";
|
|
1
|
+
import { ApexServiceClient, ChatCompletionRequest as GeneratedChatCompletionRequest, ChatCompletionResponse, ChatCompletionChunkResponse, WebRetrievalRequest as GeneratedWebRetrievalRequest, WebRetrievalResponse, ChatMessage, SubmitDeepResearcherJobResponse, GetDeepResearcherJobRequest, GetDeepResearcherJobResponse, GetStoredChatCompletionsRequest, GetStoredChatCompletionsResponse, GetChatSessionsResponse, SearchChatIdsByPromptAndCompletionTextRequest, SearchChatIdsByPromptAndCompletionTextResponse, CreateChatAndCompletionRequest, CreateChatAndCompletionResponse, CreateCompletionRequest, CreateCompletionResponse, DeleteChatsRequest, DeleteChatsResponse, DeleteCompletionsRequest, DeleteCompletionsResponse } from "../../generated/apex/v1/apex";
|
|
2
2
|
import * as grpc from "@grpc/grpc-js";
|
|
3
3
|
import { BaseClient, BaseClientOptions } from "../BaseClient";
|
|
4
4
|
import { ApexStream } from "./Stream";
|
|
@@ -85,4 +85,8 @@ export declare class ApexClient extends BaseClient {
|
|
|
85
85
|
* Delete a chat given its id
|
|
86
86
|
*/
|
|
87
87
|
deleteChats: (params: DeleteChatsRequest) => Promise<DeleteChatsResponse>;
|
|
88
|
+
/**
|
|
89
|
+
* Delete completions given their id
|
|
90
|
+
*/
|
|
91
|
+
deleteCompletions: (params: DeleteCompletionsRequest) => Promise<DeleteCompletionsResponse>;
|
|
88
92
|
}
|
package/dist/lib/apex/Client.js
CHANGED
|
@@ -231,6 +231,21 @@ class ApexClient extends BaseClient_1.BaseClient {
|
|
|
231
231
|
});
|
|
232
232
|
});
|
|
233
233
|
};
|
|
234
|
+
/**
|
|
235
|
+
* Delete completions given their id
|
|
236
|
+
*/
|
|
237
|
+
this.deleteCompletions = async (params) => {
|
|
238
|
+
const client = this.createGrpcClient();
|
|
239
|
+
return new Promise((resolve, reject) => {
|
|
240
|
+
client.deleteCompletions(params, (error, response) => {
|
|
241
|
+
if (error) {
|
|
242
|
+
reject(error);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
resolve(response);
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
};
|
|
234
249
|
this.defaultTimeout = options.timeout || 60;
|
|
235
250
|
this._grpcClient = grpcClient;
|
|
236
251
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.2.
|
|
1
|
+
export declare const VERSION = "1.2.22";
|
package/dist/version.js
CHANGED