Make reply use the API (#5389)
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user