Skip to content

Commit

Permalink
save chats
Browse files Browse the repository at this point in the history
  • Loading branch information
duke79 committed Jul 23, 2024
1 parent 06c7376 commit 4941863
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ipc/channels.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export enum ToServer {
// --- Plans ---
SAVE_PLAN = 'clientToServer.savePlan',
GET_PLANS = 'clientToServer.getPlans',
// --- Chats ---
SAVE_CHAT = 'clientToServer.saveChat',
GET_CHATS = 'clientToServer.getChats',
// --- Other Groups... ---
}

export enum ToClient {
Expand All @@ -24,4 +28,7 @@ export enum ToClient {
TOKEN_COUNT = 'serverToClient.tokenCount',
// --- Plans ---
PLANS = 'serverToClient.plans',
// --- Chats ---
CHATS = 'serverToClient.chats',
// --- Other Groups... ---
}
8 changes: 8 additions & 0 deletions src/ipc/channels.type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
BotMessageChunk,
ChatMessageType,
ChatType,
PlanType,
SummarizedResult,
SummarizedResultChunk,
Expand Down Expand Up @@ -44,5 +45,12 @@ export type ChannelBody<T extends ToServer | ToClient> =
? {}
: T extends ToClient.PLANS
? PlanType[]
// --- Chats ---
: T extends ToServer.SAVE_CHAT
? Omit<ChatType, 'id'>
: T extends ToServer.GET_CHATS
? {}
: T extends ToClient.CHATS
? ChatType[]
: // --- Other Groups... ---
never;
8 changes: 8 additions & 0 deletions src/types/code-chat.type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@

export interface ChatType {
id?: number;
title: string;
description: string;
chat_history: ChatMessageType[];
}

export interface ChatMessageType {
uuid: string;
user: 'user' | 'bot' | 'instructor';
Expand Down

0 comments on commit 4941863

Please sign in to comment.