Make reply use the API (#5389)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Douwe Osinga
2025-10-28 15:27:28 -04:00
committed by GitHub
parent 35f286a9d1
commit 4034f3fcef
7 changed files with 248 additions and 142 deletions
+1 -1
View File
@@ -351,7 +351,7 @@ export const scanRecipe = <ThrowOnError extends boolean = false>(options: Option
};
export const reply = <ThrowOnError extends boolean = false>(options: Options<ReplyData, ThrowOnError>) => {
return (options.client ?? client).post<ReplyResponses, ReplyErrors, ThrowOnError>({
return (options.client ?? client).sse.post<ReplyResponses, ReplyErrors, ThrowOnError>({
url: '/reply',
...options,
headers: {
+29 -1
View File
@@ -360,6 +360,32 @@ export type MessageContent = (TextContent & {
type: 'systemNotification';
});
export type MessageEvent = {
message: Message;
type: 'Message';
} | {
error: string;
type: 'Error';
} | {
reason: string;
type: 'Finish';
} | {
mode: string;
model: string;
type: 'ModelChange';
} | {
message: {
[key: string]: unknown;
};
request_id: string;
type: 'Notification';
} | {
conversation: Conversation;
type: 'UpdateConversation';
} | {
type: 'Ping';
};
/**
* Metadata for message visibility
*/
@@ -1825,9 +1851,11 @@ export type ReplyResponses = {
/**
* Streaming response initiated
*/
200: unknown;
200: MessageEvent;
};
export type ReplyResponse = ReplyResponses[keyof ReplyResponses];
export type CreateScheduleData = {
body: CreateScheduleRequest;
path?: never;