Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Train fix (#7938): Advanced only, the shared button, and one-skill wording

milind-sonifbde05889831
diff --git a/src/components/SkillsSection.tsx b/src/components/SkillsSection.tsx
index 20d49116d7..583f782f1c 100644
--- a/src/components/SkillsSection.tsx
+++ b/src/components/SkillsSection.tsx
@@ -3,6 +3,7 @@ import { Search, X } from "lucide-react";
import { useEffect, useMemo, useRef, useState } from "react";
import { intlLocale, t } from "@/lib/i18n";
import { useModalDialog } from "@/hooks/use-modal-dialog";
+import { useAdvancedMode } from "@/lib/interface-mode";
import { useStore } from "@/state/store";
import { Card, Switch } from "./SettingsPrimitives";
import type { SkillsLibrarySkillWire } from "../../shared/wire";
@@ -52,6 +53,7 @@ export function SkillsSection() {
const [assignBot, setAssignBot] = useState("");
const busy = useRef(false);
const fileInput = useRef<HTMLInputElement>(null);
+ const advanced = useAdvancedMode();
const bots = state.bots.filter((bot) => !bot.hidden);
const tags = useMemo(
@@ -230,12 +232,12 @@ export function SkillsSection() {
}
}
if (imported) {
- setImportMessage(t("skills.library.importFilesDone", { count: imported }));
+ setImportMessage(imported === 1 ? t("skills.library.importFileDone") : t("skills.library.importFilesDone", { count: imported }));
await refresh();
}
if (failed.length) {
const named = failed.slice(0, 3).map((file) => `${file.name} (${file.reason})`).join(", ") + (failed.length > 3 ? "…" : "");
- setError(t("skills.library.importFilesFailed", { count: failed.length, names: named }));
+ setError(failed.length === 1 ? t("skills.library.importFileFailed", { names: named }) : t("skills.library.importFilesFailed", { count: failed.length, names: named }));
}
} finally {
setImporting(false);
@@ -400,7 +402,7 @@ export function SkillsSection() {
<div className="flex items-center justify-between gap-2">
{importMessage ? <div className="text-[12px] text-ink-secondary">{importMessage}</div> : <span />}
<div className="flex shrink-0 items-center gap-2">
- <input
+ {advanced && <input
ref={fileInput}
type="file"
accept={SKILL_FILE_ACCEPT}
@@ -409,15 +411,10 @@ export function SkillsSection() {
aria-hidden="true"
tabIndex={-1}
onChange={(e) => void importFiles(e.target.files)}
- />
- <button
- type="button"
- onClick={() => fileInput.current?.click()}
- disabled={importing || Boolean(working)}
- className="rounded-lg border border-hairline/40 px-3 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-50"
- >
+ />}
+ {advanced && <button type="button" onClick={() => fileInput.current?.click()} disabled={importing || Boolean(working)} className="ui-button ui-button-md">
{t("skills.library.importFiles")}
- </button>
+ </button>}
<button
type="submit"
disabled={importing || Boolean(working) || !importText.trim()}
diff --git a/src/locales/en.json b/src/locales/en.json
index 0f423f060e..ee2bfda75c 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -6621,6 +6621,8 @@
"skills.library.importFiles": "Choose files…",
"skills.library.importFilesDone": "Imported {count} skills, disabled for review.",
"skills.library.importFilesFailed": "{count} files could not be imported: {names}",
+ "skills.library.importFileDone": "Imported 1 skill, disabled for review.",
+ "skills.library.importFileFailed": "{names} could not be imported.",
"skills.library.importPlaceholder": "---\nname: my-skill\ndescription: What it does\n---\n\nInstructions…",
"skills.library.importButton": "Import skill",
"skills.library.importing": "Importing…",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 3765d97615..eafd224a12 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -6250,6 +6250,8 @@
"skills.library.importFiles": "Escolher arquivos…",
"skills.library.importFilesDone": "{count} habilidades importadas, desligadas para revisão.",
"skills.library.importFilesFailed": "{count} arquivos não puderam ser importados: {names}",
+ "skills.library.importFileDone": "1 habilidade importada, desligada para revisão.",
+ "skills.library.importFileFailed": "Não foi possível importar {names}.",
"skills.library.importPlaceholder": "---\nname: minha-habilidade\ndescription: O que ela faz\n---\n\nInstruções…",
"skills.library.importButton": "Importar habilidade",
"skills.library.importing": "Importando…",