7a88b74016
- Artifacts hub: upload a file from the computer; make a skill by uploading a Markdown file, files, a folder or a .zip/.skill, or by writing it in the dialog; add plugins by picking from the list a marketplace link answers (POST /api/artifacts/plugin/inspect); Settings → AI tools → Artifacts Hub. - Console tabs are combos of up to four split panes (ConsoleTabs, PaneGrid). - Accounts: an own avatar (PUT/DELETE /api/me/avatar, raster only, ≤ 1 MB, <data dir>/avatars/), shown with name and role at the sidebar's foot and on the workspace owner groups (GET /api/users/:id/avatar, owner_avatar_at). - Users page: per-user storage (GET /api/users/storage, measured in a worker) and account-pool spend/tokens per account (server/lib/pool-usage.js). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
/**
|
|
* @file ArtifactsHubSettings — Settings → AI tools → Artifacts Hub: the
|
|
* admin's server-wide switch that allows or blocks installing a shared skill
|
|
* or plugin from the Hub into a user's own account (`GET/PUT
|
|
* /api/artifacts/settings`). Renders nothing in local mode (there is no Hub)
|
|
* or for anyone the server does not let manage it (`canManage`).
|
|
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
|
*/
|
|
|
|
import { useEffect, useState } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { api, type ArtifactSettings } from "../../lib/api";
|
|
import { toast } from "../../lib/toast";
|
|
import { SettingsSection, SettingsSwitchRow } from "./SettingsRow";
|
|
|
|
export function ArtifactsHubSettings() {
|
|
const { t } = useTranslation("artifacts");
|
|
const [settings, setSettings] = useState<ArtifactSettings | null>(null);
|
|
|
|
useEffect(() => {
|
|
api.artifacts
|
|
.settings()
|
|
.then(setSettings)
|
|
.catch(() => setSettings(null));
|
|
}, []);
|
|
|
|
if (!settings?.serverMode || !settings.canManage) return null;
|
|
return (
|
|
<SettingsSection id="artifacts-hub" title={t("title")}>
|
|
<SettingsSwitchRow
|
|
label={t("installsSwitch")}
|
|
description={t("installsSwitchHint")}
|
|
checked={settings.installsEnabled}
|
|
onChange={async (v) => {
|
|
try {
|
|
const r = await api.artifacts.setInstallsEnabled(v);
|
|
setSettings({ ...settings, installsEnabled: r.installsEnabled });
|
|
} catch (err) {
|
|
toast.error(err);
|
|
}
|
|
}}
|
|
/>
|
|
</SettingsSection>
|
|
);
|
|
}
|