Skip to content

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

Merge #7914: titles from the first reply, a title model picker and follow-up titles

milind-soniaf26d02546fc
diff --cc server/config.ts
index 55caf95f92,1cd8b1ed04..6d51d04ebd
--- a/server/config.ts
+++ b/server/config.ts
@@@ -396,10 -416,10 +401,10 @@@ const storedAppConfigSchema = appConfig
}).optional(),
});
const appConfigPatchSchema = appConfigSchema.omit({ instances: true, mcpServers: true, cliStartup: true, customDomain: true })
- .extend({ threads: threadsPatchSchema.optional(), newBots: newBotsPatchSchema.optional(), imageGen: imageGenPatchSchema.optional() }); export const CONFIG_PATCH_FIELDS = appConfigPatchSchema.shape;
+ .extend({ threads: threadsPatchSchema.optional(), newBots: newBotsPatchSchema.optional(), imageGen: imageGenPatchSchema.optional(), browserEngine: browserEnginePatchSchema.optional() }); export const CONFIG_PATCH_FIELDS = appConfigPatchSchema.shape;
const jsonObjectSchema = z.record(z.string(), z.json());
- export interface AppConfig extends HelperConfig {
+ export interface AppConfig extends HelperConfig, Pick<z.output<typeof appConfigSchema>, "rooms" | "mcp" | "threadTitles" | "memory" | "features" | "onboarding"> {
customDomain?: string;
signIn?: { admins?: string[]; members?: string[] };
/** Preferred selection for newly created bots; existing bots keep theirs. */
diff --cc src/components/settings/pages/FeaturesPage.tsx
index e28763d886,582b70d1c2..0bf8cc3a9e
--- a/src/components/settings/pages/FeaturesPage.tsx
+++ b/src/components/settings/pages/FeaturesPage.tsx
@@@ -4,8 -4,8 +4,9 @@@ import { t } from "@/lib/i18n"
import { useFeature, type Feature } from "@/lib/use-feature";
import { api, type ConfigStatus } from "@/state/store";
import { useStoreDispatch, useStoreSelector } from "@/state/store-select";
+ import { Select } from "../../Select";
import { SettingRow, SettingsGroup, SettingsRows, Switch } from "../../SettingsPrimitives";
+import { useSettingsShell } from "../settings-shell";
const COPY: Record<Feature, { title: LocaleKey; line: LocaleKey }> = {
skillBurger: { title: "settings.features.skillBurger", line: "settings.features.skillBurgerLine" },
@@@ -45,17 -43,98 +46,103 @@@ function FeatureRow({ name }: { name: F
);
}
+ type ThreadTitles = NonNullable<ConfigStatus["threadTitles"]>;
+ type TitleModel = NonNullable<ThreadTitles["model"]>;
+ type ThreadTitlesPatch = Pick<ThreadTitles, "model"> | Pick<ThreadTitles, "followUp">;
+
+ function titleModelKey({ instanceId, model }: TitleModel) {
+ return JSON.stringify([instanceId, model]);
+ }
+
+ function ThreadTitleRows() {
+ const titles = useStoreSelector((state) => state.config?.threadTitles);
+ const instances = useStoreSelector((state) => state.instances);
+ const dispatch = useStoreDispatch();
+ const id = useId();
+ const [feedback, setFeedback] = useState<{ field: "model" | "followUp"; saving: boolean } | null>(null);
+ if (!titles) return null;
+
+ const saving = feedback?.saving === true;
+ const choices = instances
+ .filter((instance) => titles.instances.includes(instance.instanceId) && instance.snapshot.state === "available" && !instance.policy)
+ .flatMap((instance) => instance.models.options
+ .filter((model) => !model.orgBlocked && !model.needsCliUpdate && (instance.snapshot.authenticated !== false || model.custom))
+ .map((model) => {
+ const selection = { instanceId: instance.instanceId, model: model.id };
+ return {
+ key: titleModelKey(selection),
+ label: t("settings.features.titleModelChoice", { provider: instance.displayName, model: model.label }),
+ selection,
+ };
+ }));
+ const selected = titles.model ? titleModelKey(titles.model) : "";
+ const currentChoice = choices.find((choice) => choice.key === selected);
+ const unavailable = titles.model && !currentChoice
+ ? t("settings.features.titleModelUnavailable", { model: titles.model.model })
+ : undefined;
+ const automatic = t("settings.features.titleModelAutomatic");
+ const modelLabel = t("settings.features.titleModel");
+ const followUpLabel = t("settings.features.titleFollowUp");
+ const noChoices = !titles.model && choices.length === 0;
+
+ const save = async (threadTitles: ThreadTitlesPatch) => {
+ if (saving) return;
+ const field = "model" in threadTitles ? "model" : "followUp";
+ setFeedback({ field, saving: true });
+ try {
+ const config = await api<ConfigStatus>("/api/config", { method: "PATCH", body: JSON.stringify({ threadTitles }) });
+ dispatch({ type: "configStatus", config });
+ setFeedback(null);
+ } catch {
+ setFeedback({ field, saving: false });
+ }
+ };
+ const status = (field: "model" | "followUp") => {
+ if (feedback?.field !== field) return undefined;
+ return saving ? <span role="status">{t("settings.threads.saving")}</span>
+ : <span role="alert" className="text-danger">{t("settings.features.error")}</span>;
+ };
+
+ return (
+ <>
+ <SettingRow title={modelLabel} message={status("model")}
+ subtitle={noChoices ? <span id={`${id}-model`}>{t("settings.features.titleModelConnect")}</span> : undefined}>
+ <Select aria-label={modelLabel} aria-describedby={noChoices ? `${id}-model` : undefined}
+ title={currentChoice?.label ?? unavailable ?? automatic} value={selected} disabled={saving || noChoices}
+ onChange={(event) => {
+ const key = event.target.value;
+ if (key === "") void save({ model: null });
+ else {
+ const choice = choices.find((option) => option.key === key);
+ if (choice) void save({ model: choice.selection });
+ }
+ }}>
+ <option value="">{automatic}</option>
+ {unavailable && <option value={selected} disabled>{unavailable}</option>}
+ {choices.map((choice) => <option key={choice.key} value={choice.key}>{choice.label}</option>)}
+ </Select>
+ </SettingRow>
+ <SettingRow title={followUpLabel} subtitle={<span id={`${id}-follow-up`}>{t("settings.features.titleFollowUpLine")}</span>} message={status("followUp")}>
+ <Switch checked={titles.followUp} aria-label={followUpLabel} aria-describedby={`${id}-follow-up`}
+ disabled={saving} onClick={() => void save({ followUp: !titles.followUp })} />
+ </SettingRow>
+ </>
+ );
+ }
+
export function FeaturesPage() {
- // The Skills section the library switch reveals is on the Bots page, which only Advanced lists.
++ // Advanced only: the Skills section the library switch reveals is on the Advanced-only Bots page, and the title model
++ // and follow-up titles are technical choices that spend on a model.
+ const { ctx } = useSettingsShell();
return (
<SettingsGroup block="features">
<SettingsRows>
<FeatureRow name="skillBurger" />
<FeatureRow name="threadTabs" />
<FeatureRow name="suggestedReplies" />
- <ThreadTitleRows />
+ {ctx.advanced && <FeatureRow name="skillsLibrary" />}
+ <FeatureRow name="promotions" />
++ {ctx.advanced && <ThreadTitleRows />}
</SettingsRows>
</SettingsGroup>
);
diff --cc src/locales/en.json
index b317e6c8d7,ebf35169df..7dd9fe6c7f
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@@ -12239,12 -12228,15 +12239,19 @@@
"settings.features.skillBurgerLine": "Save a bot's run as steps you can run again",
"settings.features.threadTabs": "Thread tabs",
"settings.features.threadTabsLine": "Show a bot's threads as tabs above the chat",
+ "settings.features.promotions": "Promotional messages",
+ "settings.features.promotionsLine": "Show upgrade offers and sponsored messages.",
"settings.features.suggestedReplies": "Suggested replies",
"settings.features.suggestedRepliesLine": "After a bot replies, suggest what you might say next. The bot's own AI writes it with its smallest model, which uses a little of your plan or API credit.",
+ "settings.features.skillsLibrary": "Skills library",
+ "settings.features.skillsLibraryLine": "Show the Skills section in Settings, where you can browse, import and assign skills to bots",
+ "settings.features.titleModel": "Thread title model",
+ "settings.features.titleModelAutomatic": "Automatic",
+ "settings.features.titleModelChoice": "{provider} · {model}",
+ "settings.features.titleModelUnavailable": "{model} (unavailable)",
+ "settings.features.titleModelConnect": "Connect a compatible AI to choose a title model.",
+ "settings.features.titleFollowUp": "Update thread titles",
+ "settings.features.titleFollowUpLine": "Refresh automatic titles when a conversation changes direction. Titles you set stay as they are.",
"composer.placeholder.newThread": "Start a thread in {name}",
"room.feed.aria": "Threads in {name}",
"room.feed.replyOne": "1 reply",