This commit is contained in:
parent
509a0ea3d7
commit
94096979ad
|
|
@ -13,6 +13,8 @@ import { CreatePreset } from "./items/presets/create-preset"
|
|||
import { CreatePrompt } from "./items/prompts/create-prompt"
|
||||
import { CreateTool } from "./items/tools/create-tool"
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
interface SidebarCreateButtonsProps {
|
||||
contentType: ContentType
|
||||
hasData: boolean
|
||||
|
|
@ -22,7 +24,10 @@ export const SidebarCreateButtons: FC<SidebarCreateButtonsProps> = ({
|
|||
contentType,
|
||||
hasData
|
||||
}) => {
|
||||
const { profile, selectedWorkspace, folders, setFolders } =
|
||||
|
||||
const { t, i18n } = useTranslation();
|
||||
|
||||
const { profile, selectedWorkspace, folders, setFolders } =
|
||||
useContext(ChatbotUIContext)
|
||||
const { handleNewChat } = useChatHandler()
|
||||
|
||||
|
|
@ -95,13 +100,31 @@ export const SidebarCreateButtons: FC<SidebarCreateButtonsProps> = ({
|
|||
}
|
||||
}
|
||||
|
||||
// 获取当前语言
|
||||
const language = i18n.language;
|
||||
|
||||
// 判断需要大写首字母的语言
|
||||
const needsUpperCaseFirstLetter = (language: string) => {
|
||||
const languagesRequiringUpperCase = ['en', 'de', 'fr', 'es', 'it']; // 其他需要大写首字母的语言
|
||||
return languagesRequiringUpperCase.includes(language);
|
||||
};
|
||||
|
||||
// 对动态内容进行首字母大写的处理
|
||||
const getCapitalizedContentType = (contentType: string, language: string) => {
|
||||
if (needsUpperCaseFirstLetter(language)) {
|
||||
return contentType.charAt(0).toUpperCase() + contentType.slice(1, contentType.length - 1); // 保留去掉最后一个字符
|
||||
}
|
||||
return contentType; // 不需要大写的语言返回原始值
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex w-full space-x-2">
|
||||
<Button className="flex h-[36px] grow" onClick={getCreateFunction()}>
|
||||
<IconPlus className="mr-1" size={20} />
|
||||
New{" "}
|
||||
{contentType.charAt(0).toUpperCase() +
|
||||
contentType.slice(1, contentType.length - 1)}
|
||||
|
||||
{t('New')}{" "}
|
||||
{getCapitalizedContentType(contentType, language)}
|
||||
|
||||
</Button>
|
||||
|
||||
{hasData && (
|
||||
|
|
|
|||
|
|
@ -291,12 +291,11 @@ export const WorkspaceSettings: FC<WorkspaceSettingsProps> = ({}) => {
|
|||
|
||||
<div className="space-x-2">
|
||||
<Button variant="ghost" onClick={() => setIsOpen(false)}>
|
||||
Cancel
|
||||
{t("side.cancel")}
|
||||
{t("side.cancel")}
|
||||
</Button>
|
||||
|
||||
<Button ref={buttonRef} onClick={handleSave}>
|
||||
{t("side.save")}
|
||||
{t("side.save")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@
|
|||
"aiResponseInstructions": "How would you like the AI to respond in this workspace?",
|
||||
"workspaceNamePlaceholder": "Name...",
|
||||
"workspaceBeginSettings": "These are the settings your workspace begins with when selected.",
|
||||
"workspaceInstructionsPlaceholder": "Instructions... (optional)"
|
||||
"workspaceInstructionsPlaceholder": "Instructions... (optional)",
|
||||
"sidebarCreateNew": "New"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,8 @@
|
|||
"aiResponseInstructions": "このワークスペースでAIにどのように応答してほしいですか?",
|
||||
"workspaceNamePlaceholder": "名前を入力...",
|
||||
"workspaceBeginSettings": "これらはワークスペースを選択したときに始まる設定です。",
|
||||
"workspaceInstructionsPlaceholder": "説明...(オプション)"
|
||||
"workspaceInstructionsPlaceholder": "説明...(オプション)",
|
||||
"sidebarCreateNew": "新規作成"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,8 @@
|
|||
"aiResponseInstructions": "您希望 AI 在此工作区内如何回应?",
|
||||
"workspaceNamePlaceholder": "请输入名称...",
|
||||
"workspaceBeginSettings": "这些是选择此工作区时的初始设置。",
|
||||
"workspaceInstructionsPlaceholder": "说明...(可选)"
|
||||
"workspaceInstructionsPlaceholder": "说明...(可选)",
|
||||
"sidebarCreateNew": "新建"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue