From 1affbb4cc860eeed2702380c2538a8fcb06cb893 Mon Sep 17 00:00:00 2001 From: Kishan_Singh <147229665+kishansinghifs1@users.noreply.github.com> Date: Fri, 3 Oct 2025 05:57:03 +0000 Subject: [PATCH] fix: support async iterator for AI chat streaming mode in types --- src/puter-js/index.d.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/puter-js/index.d.ts b/src/puter-js/index.d.ts index b772c694c..5693f826c 100644 --- a/src/puter-js/index.d.ts +++ b/src/puter-js/index.d.ts @@ -32,11 +32,11 @@ declare class Puter { // AI Module interface AI { - chat(prompt: string, options?: ChatOptions): Promise; - chat(prompt: string, testMode?: boolean, options?: ChatOptions): Promise; - chat(prompt: string, imageURL?: string, testMode?: boolean, options?: ChatOptions): Promise; - chat(prompt: string, imageURLArray?: string[], testMode?: boolean, options?: ChatOptions): Promise; - chat(messages: ChatMessage[], testMode?: boolean, options?: ChatOptions): Promise; + chat(prompt: string, options?: ChatOptions): Promise | AsyncIterable; + chat(prompt: string, testMode?: boolean, options?: ChatOptions): Promise | AsyncIterable; + chat(prompt: string, imageURL?: string, testMode?: boolean, options?: ChatOptions): Promise | AsyncIterable; + chat(prompt: string, imageURLArray?: string[], testMode?: boolean, options?: ChatOptions): Promise | AsyncIterable; + chat(messages: ChatMessage[], testMode?: boolean, options?: ChatOptions): Promise | AsyncIterable; img2txt(image: string | File | Blob, testMode?: boolean): Promise; @@ -109,6 +109,11 @@ interface Txt2SpeechOptions { engine?: 'standard' | 'neural' | 'generative'; } +interface ChatResponseChunk { + text?: string; + [key: string]: any; +} + // Apps Module interface Apps { create(name: string, indexURL: string): Promise;