diff --git a/sdks/typescript/src/chat.ts b/sdks/typescript/src/chat.ts index 7292d71c..540722b5 100644 --- a/sdks/typescript/src/chat.ts +++ b/sdks/typescript/src/chat.ts @@ -12,7 +12,6 @@ import type { ConversationListResponse, DoneEvent, Message, - SearchFilters, Source, SourcesEvent, StreamEvent, @@ -69,11 +68,11 @@ export class ChatStream implements AsyncIterable, Disposable { }; if (this.options.chatId) { - body.chat_id = this.options.chatId; + body["chat_id"] = this.options.chatId; } if (this.options.filters) { - body.filters = this.options.filters; + body["filters"] = this.options.filters; } this._response = await this.client._request("POST", "/api/v1/chat", { @@ -212,11 +211,11 @@ export class ChatClient { }; if (options.chatId) { - body.chat_id = options.chatId; + body["chat_id"] = options.chatId; } if (options.filters) { - body.filters = options.filters; + body["filters"] = options.filters; } const response = await this.client._request("POST", "/api/v1/chat", { @@ -260,11 +259,11 @@ export class ChatClient { const conversations: Conversation[] = (data.conversations || []).map( (c: Record) => ({ - chatId: c.chat_id, - title: c.title || "", - createdAt: c.created_at || null, - lastActivity: c.last_activity || null, - messageCount: c.message_count || 0, + chatId: c["chat_id"], + title: c["title"] || "", + createdAt: c["created_at"] || null, + lastActivity: c["last_activity"] || null, + messageCount: c["message_count"] || 0, }) ); @@ -282,9 +281,9 @@ export class ChatClient { const messages: Message[] = (data.messages || []).map( (m: Record) => ({ - role: m.role, - content: m.content, - timestamp: m.timestamp || null, + role: m["role"], + content: m["content"], + timestamp: m["timestamp"] || null, }) ); diff --git a/sdks/typescript/src/client.ts b/sdks/typescript/src/client.ts index 2e73ee5a..2ea99b43 100644 --- a/sdks/typescript/src/client.ts +++ b/sdks/typescript/src/client.ts @@ -139,7 +139,7 @@ export class OpenRAGClient { const response = await fetch(url, { method, headers, - body: options.body, + body: options.body ?? null, signal: controller.signal, }); diff --git a/sdks/typescript/src/search.ts b/sdks/typescript/src/search.ts index 4a10da10..09d2d57e 100644 --- a/sdks/typescript/src/search.ts +++ b/sdks/typescript/src/search.ts @@ -3,7 +3,7 @@ */ import type { OpenRAGClient } from "./client"; -import type { SearchFilters, SearchQueryOptions, SearchResponse } from "./types"; +import type { SearchQueryOptions, SearchResponse } from "./types"; export class SearchClient { constructor(private client: OpenRAGClient) {} @@ -26,7 +26,7 @@ export class SearchClient { }; if (options?.filters) { - body.filters = options.filters; + body["filters"] = options.filters; } const response = await this.client._request("POST", "/api/v1/search", { diff --git a/sdks/typescript/tests/integration.test.ts b/sdks/typescript/tests/integration.test.ts index 2eaedc64..23eb3755 100644 --- a/sdks/typescript/tests/integration.test.ts +++ b/sdks/typescript/tests/integration.test.ts @@ -115,13 +115,7 @@ describe.skipIf(SKIP_TESTS)("OpenRAG TypeScript SDK Integration", () => { describe("Search", () => { it("should search documents", async () => { - // Ensure document is ingested - await client.documents.ingest({ filePath: testFilePath }); - - // Wait for indexing - await new Promise((resolve) => setTimeout(resolve, 2000)); - - // Search + // Documents already ingested by previous tests const results = await client.search.query("orange kangaroos jumping"); expect(results.results).toBeDefined();