@@ -9,6 +9,7 @@ import { createLoggedHandler } from "./safe_handle";
|
||||
|
||||
import log from "electron-log";
|
||||
import { getDyadAppPath } from "../../paths/paths";
|
||||
import { UpdateChatParams } from "../ipc_types";
|
||||
|
||||
const logger = log.scope("chat_handlers");
|
||||
const handle = createLoggedHandler(logger);
|
||||
@@ -107,6 +108,10 @@ export function registerChatHandlers() {
|
||||
await db.delete(chats).where(eq(chats.id, chatId));
|
||||
});
|
||||
|
||||
handle("update-chat", async (_, { chatId, title }: UpdateChatParams) => {
|
||||
await db.update(chats).set({ title }).where(eq(chats.id, chatId));
|
||||
});
|
||||
|
||||
handle("delete-messages", async (_, chatId: number): Promise<void> => {
|
||||
await db.delete(messages).where(eq(messages.chatId, chatId));
|
||||
});
|
||||
|
||||
@@ -49,6 +49,7 @@ import type {
|
||||
IsVercelProjectAvailableParams,
|
||||
SaveVercelAccessTokenParams,
|
||||
VercelProject,
|
||||
UpdateChatParams,
|
||||
} from "./ipc_types";
|
||||
import type { AppChatContext, ProposalResult } from "@/lib/schemas";
|
||||
import { showError } from "@/lib/toast";
|
||||
@@ -351,6 +352,10 @@ export class IpcClient {
|
||||
return this.ipcRenderer.invoke("create-chat", appId);
|
||||
}
|
||||
|
||||
public async updateChat(params: UpdateChatParams): Promise<void> {
|
||||
return this.ipcRenderer.invoke("update-chat", params);
|
||||
}
|
||||
|
||||
public async deleteChat(chatId: number): Promise<void> {
|
||||
await this.ipcRenderer.invoke("delete-chat", chatId);
|
||||
}
|
||||
|
||||
@@ -316,3 +316,8 @@ export interface VercelProject {
|
||||
name: string;
|
||||
framework: string | null;
|
||||
}
|
||||
|
||||
export interface UpdateChatParams {
|
||||
chatId: number;
|
||||
title: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user