diff --git a/app/components/chat.tsx b/app/components/chat.tsx index c5c257e5..fbac9f2c 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -19,6 +19,7 @@ import { BOT_HELLO, ROLES, createMessage, + useAccessStore, } from "../store"; import { @@ -485,11 +486,17 @@ export function Chat(props: { const context: RenderMessage[] = session.context.slice(); + const accessStore = useAccessStore(); + if ( context.length === 0 && session.messages.at(0)?.content !== BOT_HELLO.content ) { - context.push(BOT_HELLO); + const copiedHello = Object.assign({}, BOT_HELLO); + if (!accessStore.isAuthorized()) { + copiedHello.content = Locale.Error.Unauthorized; + } + context.push(copiedHello); } // preview messages diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 15fe5839..bbb28b46 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -124,8 +124,7 @@ export function Settings(props: { closeSettings: () => void }) { const builtinCount = SearchService.count.builtin; const customCount = promptStore.prompts.size ?? 0; - const showUsage = !!accessStore.token || !!accessStore.accessCode; - + const showUsage = accessStore.isAuthorized(); useEffect(() => { checkUpdate(); showUsage && checkUsage(); @@ -346,37 +345,7 @@ export function Settings(props: { closeSettings: () => void }) { > - - - - updateConfig( - (config) => - (config.disablePromptHint = e.currentTarget.checked), - ) - } - > - - - } - text={Locale.Settings.Prompt.Edit} - onClick={() => showToast(Locale.WIP)} - /> - - {enabledAccessControl ? ( void }) { + + + + updateConfig( + (config) => + (config.disablePromptHint = e.currentTarget.checked), + ) + } + > + + + + } + text={Locale.Settings.Prompt.Edit} + onClick={() => showToast(Locale.WIP)} + /> + + +