From 3f0de68c968be3d07e9cda8259c4c17a92d0f8c2 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Tue, 24 Oct 2023 21:21:37 +0700 Subject: [PATCH 1/2] Fix app version --- web/containers/BottomBar/index.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/web/containers/BottomBar/index.tsx b/web/containers/BottomBar/index.tsx index bb668f452d..a69a0de4b6 100644 --- a/web/containers/BottomBar/index.tsx +++ b/web/containers/BottomBar/index.tsx @@ -1,18 +1,15 @@ import React from 'react' import SystemItem from '@containers/SystemItem' -import { useAtomValue } from 'jotai' -import useGetAppVersion from '@hooks/useGetAppVersion' import useGetSystemResources from '@hooks/useGetSystemResources' +import { useAtomValue } from 'jotai' import { modelDownloadStateAtom } from '@helpers/atoms/DownloadState.atom' import { formatDownloadPercentage } from '@utils/converter' import { activeAssistantModelAtom } from '@helpers/atoms/Model.atom' const BottomBar = () => { const activeModel = useAtomValue(activeAssistantModelAtom) - const { version } = useGetAppVersion() const { ram, cpu } = useGetSystemResources() const modelDownloadStates = useAtomValue(modelDownloadStateAtom) - const getCurrentYear = new Date().getFullYear() const downloadStates: DownloadState[] = [] for (const [, value] of Object.entries(modelDownloadStates)) { @@ -35,9 +32,7 @@ const BottomBar = () => {
-

- ©{getCurrentYear} Jan AI Pte Ltd. v{version} -

+

Jan v0.2.0

) From 2cf9c0f26c0904e3a7d5a8dcb7439122c179e462 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Tue, 24 Oct 2023 21:29:41 +0700 Subject: [PATCH 2/2] Remove unused code folder --- web/app/_hooks/useCreateBot.ts | 14 ------------- web/app/_hooks/useDeleteBot.ts | 24 ----------------------- web/app/_hooks/useGetBots.ts | 27 ------------------------- web/app/_hooks/useUpdateBot.ts | 36 ---------------------------------- web/app/_models/Bot.ts | 32 ------------------------------ 5 files changed, 133 deletions(-) delete mode 100644 web/app/_hooks/useCreateBot.ts delete mode 100644 web/app/_hooks/useDeleteBot.ts delete mode 100644 web/app/_hooks/useGetBots.ts delete mode 100644 web/app/_hooks/useUpdateBot.ts delete mode 100644 web/app/_models/Bot.ts diff --git a/web/app/_hooks/useCreateBot.ts b/web/app/_hooks/useCreateBot.ts deleted file mode 100644 index 927cb7bb01..0000000000 --- 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 43e12ecc77..0000000000 --- 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 ad14971601..0000000000 --- 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 1144ba32bd..0000000000 --- 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 33a35f85b2..0000000000 --- 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 -}