Files
cobble/src/pages/admin/bots/[bot_id]/(partials)/no-model-notice.tsx
T
tbenandClaude Opus 5.5 1e7834ba7f Add a guided setup after signup, and a no-model notice in conversations
The first super admin now lands on Settings > Setup after signing up: a
skippable walk through the app name, connecting a model provider and
picking models, ending with where to go next. It stays under Settings to
come back to.

While a bot has no text model, its conversation shows a notice in the
thread (centred when empty): super admins get Connect a provider and
Guided setup, everyone else is told the super admin sets it up. The
models modal keeps it current.

The Models page's data and save logic move into useModelsOverview, shared
with the setup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 18:26:20 +01:00

67 lines
2.8 KiB
TypeScript

import { useContext } from "react";
import Button from "@moduletrace/twui/layout/Button";
import Row from "@moduletrace/twui/layout/Row";
import Span from "@moduletrace/twui/layout/Span";
import Stack from "@moduletrace/twui/layout/Stack";
import { ArrowRight, CpuAi } from "lucide-react";
import { SettingsModelsPath, SettingsSetupPath } from "@/src/dict/settings-pages-dict";
import { AppContext } from "@/src/pages/__root";
import IconTile from "@/src/components/general/icon-tile";
import isPassThroughUser from "@/src/utils/rbac/is-pass-through-user";
type Props = {
bot_name: string;
};
/**
* Shown in the conversation while the bot has no text model to run on
* (nothing would answer a message). A super admin is sent to connect a
* provider, or to the guided setup; anyone else is told who can.
*/
export default function NoModelNotice({ bot_name }: Props) {
const { pageProps } = useContext(AppContext);
const can_set_up = isPassThroughUser({ user_types: pageProps?.user_types });
return (
<Stack
role="status"
className="w-full max-w-[440px] mx-auto gap-3! items-start rounded-default border border-solid border-hairline bg-surface px-5 py-4"
>
<Row className="gap-3! flex-nowrap items-center">
<IconTile Icon={CpuAi} />
<Span className="text-sm font-bold leading-5 text-ink">
{can_set_up ? "Connect a model provider" : "No model set up yet"}
</Span>
</Row>
<Span className="text-[13px] leading-5 text-ink-secondary">
{can_set_up
? `${bot_name} has no model to think with, so nothing would answer yet. Add a provider key (OpenRouter has free models) and pick what your bots run on.`
: `${bot_name} has no model to think with, so nothing would answer yet. The super admin connects one in Settings.`}
</Span>
{can_set_up ? (
<Row className="w-full gap-2! justify-end">
<Button
title="Open the guided setup"
type="button"
variant="outlined"
color="gray"
size="small"
href={SettingsSetupPath}
>
Guided setup
</Button>
<Button
title="Connect a provider"
type="button"
size="small"
href={SettingsModelsPath}
afterIcon={<ArrowRight size={14} aria-hidden />}
>
Connect a provider
</Button>
</Row>
) : null}
</Stack>
);
}