diff --git a/web/app/_hooks/useCreateBot.ts b/web/app/_hooks/useCreateBot.ts deleted file mode 100644 index 927cb7bb0..000000000 --- a/web/app/_hooks/useCreateBot.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { executeSerial } from '../../../electron/core/plugin-manager/execution/extension-manager' - -export default function useCreateBot() { - const createBot = async (bot: Bot) => { - try { - await executeSerial('createBot', bot) - } catch (err) { - alert(err) - console.error(err) - } - } - - return { createBot } -} diff --git a/web/app/_hooks/useDeleteBot.ts b/web/app/_hooks/useDeleteBot.ts deleted file mode 100644 index 43e12ecc7..000000000 --- a/web/app/_hooks/useDeleteBot.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { useSetAtom } from 'jotai' -import { executeSerial } from '../../../electron/core/plugin-manager/execution/extension-manager' -import { activeBotAtom } from '@helpers/atoms/Bot.atom' -import { rightSideBarExpandStateAtom } from '@helpers/atoms/SideBarExpand.atom' - -export default function useDeleteBot() { - const setActiveBot = useSetAtom(activeBotAtom) - const setRightPanelVisibility = useSetAtom(rightSideBarExpandStateAtom) - - const deleteBot = async (botId: string): Promise<'success' | 'failed'> => { - try { - await executeSerial('deleteBot', botId) - setRightPanelVisibility(false) - setActiveBot(undefined) - return 'success' - } catch (err) { - alert(`Failed to delete bot ${botId}: ${err}`) - console.error(err) - return 'failed' - } - } - - return { deleteBot } -} diff --git a/web/app/_hooks/useGetBots.ts b/web/app/_hooks/useGetBots.ts deleted file mode 100644 index ad1497160..000000000 --- a/web/app/_hooks/useGetBots.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { executeSerial } from '../../../electron/core/plugin-manager/execution/extension-manager' - -export default function useGetBots() { - const getAllBots = async (): Promise => { - try { - const bots = await executeSerial('getBots') - return bots - } catch (err) { - alert(`Failed to get bots: ${err}`) - console.error(err) - return [] - } - } - - const getBotById = async (botId: string): Promise => { - try { - const bot: Bot = await executeSerial('getBotById', botId) - return bot - } catch (err) { - alert(`Failed to get bot ${botId}: ${err}`) - console.error(err) - return undefined - } - } - - return { getBotById, getAllBots } -} diff --git a/web/app/_hooks/useUpdateBot.ts b/web/app/_hooks/useUpdateBot.ts deleted file mode 100644 index 1144ba32b..000000000 --- a/web/app/_hooks/useUpdateBot.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { executeSerial } from '../../../electron/core/plugin-manager/execution/extension-manager' - -export default function useUpdateBot() { - const updateBot = async ( - bot: Bot, - updatableField: UpdatableField - ): Promise => { - try { - // TODO: if bot does not changed, no need to update - - for (const [key, value] of Object.entries(updatableField)) { - if (value !== undefined) { - //@ts-ignore - bot[key] = value - } - } - - await executeSerial('updateBot', bot) - console.debug('Bot updated', JSON.stringify(bot, null, 2)) - } catch (err) { - alert(`Update bot error: ${err}`) - console.error(err) - return - } - } - - return { updateBot } -} - -export type UpdatableField = { - presencePenalty?: number - frequencyPenalty?: number - maxTokens?: number - customTemperature?: number - systemPrompt?: number -} diff --git a/web/app/_models/Bot.ts b/web/app/_models/Bot.ts deleted file mode 100644 index 33a35f85b..000000000 --- a/web/app/_models/Bot.ts +++ /dev/null @@ -1,32 +0,0 @@ -export type Bot = { - _id: string - name: string - description: string - visibleFromBotProfile: boolean - systemPrompt: string - welcomeMessage: string - publiclyAccessible: boolean - suggestReplies: boolean - renderMarkdownContent: boolean - - /** - * If true, the bot will use the custom temperature value instead of the - * default temperature value. - */ - enableCustomTemperature: boolean - - /** - * Default is 0.7. - */ - customTemperature: number - - maxTokens: number - - frequencyPenalty: number - - presencePenalty: number - - modelId: string - createdAt?: number - updatedAt?: number -}