Skip to content

Commit

Permalink
chore: fixing type issue with updated aws-amplify dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanksdesign committed Oct 17, 2024
1 parent 3652ea2 commit 0baba5a
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions packages/react-ai/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type ConversationRoute = V6Client<any>['conversations'][string];
export type Conversation = NonNullable<
Awaited<ReturnType<ConversationRoute['create']>>['data']
>;

export type ConversationMessage = NonNullable<
Awaited<ReturnType<Conversation['sendMessage']>>['data']
>;
Expand All @@ -14,20 +15,28 @@ export type TextContent = NonNullable<ConversationMessageContent['text']>;

export type ImageContent = NonNullable<ConversationMessageContent['image']>;

export type InputContent = Parameters<
Conversation['sendMessage']
>[0]['content'][number];
// Note: the conversation sendMessage function is an overload
// that accepts a stirng OR an object
export type InputContent = Exclude<
Parameters<Conversation['sendMessage']>[0],
string
>['content'][number];

export type SendMessageContent = Parameters<
Conversation['sendMessage']
>[0]['content'];
export type SendMessageContent = Exclude<
Parameters<Conversation['sendMessage']>[0],
string
>['content'];

export type SendMessageContext = Parameters<
Conversation['sendMessage']
>[0]['aiContext'];
export type SendMessageContext = Exclude<
Parameters<Conversation['sendMessage']>[0],
string
>['aiContext'];

export type ToolConfiguration = NonNullable<
Parameters<Conversation['sendMessage']>[0]['toolConfiguration']
Exclude<
Parameters<Conversation['sendMessage']>[0],
string
>['toolConfiguration']
>;

export interface SendMesageParameters {
Expand Down

0 comments on commit 0baba5a

Please sign in to comment.