Skip to content

Commit

Permalink
updated chat types
Browse files Browse the repository at this point in the history
  • Loading branch information
orangecoloured committed Mar 4, 2025
1 parent f2418b5 commit 76abfe6
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 43 deletions.
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "instill-sdk",
"version": "0.15.0-rc.12",
"version": "0.15.0-rc.13",
"description": "Instill AI's Typescript SDK",
"repository": "https://github.com/instill-ai/typescript-sdk.git",
"bugs": "https://github.com/instill-ai/community/issues",
Expand Down
90 changes: 49 additions & 41 deletions packages/sdk/src/chat/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,60 +60,68 @@ export type InstillChatEventCommonData = {
createTime: string;
};

export type InstillChatEventStatusData = InstillChatEventCommonData & {
chatStatus: string;
export type InstillChatEventStatus = {
event: InstillChatTypeEnum.StatusUpdated;
data: InstillChatEventCommonData & {
chatStatus: string;
};
};

export type InstillChatEventOutputData = InstillChatEventCommonData & {
outputChunkDelta: string;
export type InstillChatEventOutput = {
event: InstillChatTypeEnum.OutputUpdated;
data: InstillChatEventCommonData & {
outputChunkDelta: string;
};
};

export type InstillChatEventNameData = InstillChatEventCommonData & {
name: string;
export type InstillChatEventName = {
event: InstillChatTypeEnum.NameUpdated;
data: InstillChatEventCommonData & {
name: string;
};
};

export type InstillChatEventDebugData = InstillChatEventCommonData & {
debugOutput: string;
export type InstillChatEventDebug = {
event: InstillChatTypeEnum.DebugOutputUpdated;
data: InstillChatEventCommonData & {
debugOutput: string;
};
};

export type InstillChatEventReplanData = InstillChatEventCommonData & {
numberOfReplan: number;
export type InstillChatEventReplan = {
event: InstillChatTypeEnum.ReplanTriggered;
data: InstillChatEventCommonData & {
numberOfReplan: number;
};
};

export type InstillChatEventErrorData = InstillChatEventCommonData & {
errorType: InstillChatErrorType;
error: string;
export type InstillChatEventError = {
event: InstillChatTypeEnum.ErrorUpdated;
data: InstillChatEventCommonData & {
errorType: InstillChatErrorType;
error: string;
};
};

export type InstillChatEventStart = {
event: InstillChatTypeEnum.Started;
data: InstillChatEventCommonData;
};

export type InstillChatEventEnd = {
event: InstillChatTypeEnum.Ended;
data: InstillChatEventCommonData;
};

export type InstillChatEvent =
| {
event: InstillChatTypeEnum.Started | InstillChatTypeEnum.Ended;
data: InstillChatEventCommonData;
}
| {
event: InstillChatTypeEnum.StatusUpdated;
data: InstillChatEventStatusData;
}
| {
event: InstillChatTypeEnum.OutputUpdated;
data: InstillChatEventOutputData;
}
| {
event: InstillChatTypeEnum.NameUpdated;
data: InstillChatEventNameData;
}
| {
event: InstillChatTypeEnum.DebugOutputUpdated;
data: InstillChatEventDebugData;
}
| {
event: InstillChatTypeEnum.ReplanTriggered;
data: InstillChatEventReplanData;
}
| {
event: InstillChatTypeEnum.ErrorUpdated;
data: InstillChatEventErrorData;
};
| InstillChatEventStatus
| InstillChatEventOutput
| InstillChatEventName
| InstillChatEventDebug
| InstillChatEventReplan
| InstillChatEventError
| InstillChatEventStart
| InstillChatEventEnd;

export type InstillChatFeed = InstillChatMessage[];

Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@instill-ai/toolkit",
"version": "0.117.0-rc.5",
"version": "0.117.0-rc.8",
"description": "Instill AI's frontend toolkit",
"repository": "https://github.com/instill-ai/design-system.git",
"bugs": "https://github.com/instill-ai/design-system/issues",
Expand Down

0 comments on commit 76abfe6

Please sign in to comment.