DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
feat: discoverable profile rename and auto-name by provider
Ilia Avdeev17e0547ae21d
diff --git a/web/components/settings/ServiceConfigEditor.tsx b/web/components/settings/ServiceConfigEditor.tsxindex ae220bb15..80db655e8 100644--- a/web/components/settings/ServiceConfigEditor.tsx+++ b/web/components/settings/ServiceConfigEditor.tsx@@ -8,6 +8,7 @@ import {EyeOff,Info,Loader2,+ Pencil,Plus,Terminal,Trash2,@@ -25,6 +26,7 @@ import {useSettings,} from "./SettingsContext";import { DimensionField } from "./DimensionField";+import { nextProfileName } from "./profile-naming";import {activeProfileDetail,deprecatedSearchProviders,@@ -265,12 +267,24 @@ export function ServiceConfigEditor({ service }: { service: ServiceName }) {size={13}/><div- className={`min-w-0 truncate text-[13px] leading-tight ${+ className={`min-w-0 flex-1 truncate text-[13px] leading-tight ${isActive ? "font-semibold" : "font-medium"}`}>{profile.name}</div>+ <button+ type="button"+ onClick={(e) => {+ e.stopPropagation();+ startProfileRename(profile);+ }}+ className="-mr-1 shrink-0 rounded-md p-1 text-[var(--muted-foreground)]/60 transition-colors hover:bg-[var(--muted)] hover:text-[var(--foreground)]"+ aria-label={t("Rename profile")}+ title={t("Rename profile")}+ >+ <Pencil className="h-3 w-3" />+ </button></div>)}<div className="mt-0.5 truncate text-[11px] leading-tight text-[var(--muted-foreground)]/70">@@ -769,10 +783,20 @@ function ProfileFields({onChange={(e) => {const val = e.target.value;const field = service === "search" ? "provider" : "binding";+ const options = providers[service] || [];+ const previousLabel =+ options.find((p) => p.value === providerValue)?.label ?? "";+ const match = options.find((p) => p.value === val);updateProfileField(service, field, val);- const match = (providers[service] || []).find(- (p) => p.value === val,+ // Keep an un-customized profile name tracking its provider.+ const renamed = nextProfileName(+ profile.name,+ previousLabel,+ match?.label ?? "",);+ if (renamed !== profile.name) {+ updateProfileField(service, "name", renamed);+ }if (match?.base_url) {updateProfileField(service, "base_url", match.base_url);}diff --git a/web/components/settings/profile-naming.ts b/web/components/settings/profile-naming.tsnew file mode 100644index 000000000..66a00900c--- /dev/null+++ b/web/components/settings/profile-naming.ts@@ -0,0 +1,25 @@+// Auto-naming for connection profiles.+//+// A new profile is created already named after its provider (see `addProfile`+// in SettingsContext). As long as the user hasn't typed a custom name, we want+// the name to keep tracking the provider when they switch it — so a profile+// created as "Brave" becomes "Jina" when the provider changes to Jina, but a+// profile the user renamed to "My search" is left untouched.+//+// The heuristic is deliberately stateless (no extra persisted field): the name+// is considered "auto" when it is empty or still equals the previous provider's+// label. Once it diverges, it is treated as user-owned and never overwritten.++export function nextProfileName(+ currentName: string,+ previousProviderLabel: string,+ nextProviderLabel: string,+): string {+ // Never overwrite with an empty label (e.g. "Select provider…").+ if (!nextProviderLabel) return currentName;+ const trimmed = (currentName ?? "").trim();+ if (trimmed === "" || trimmed === (previousProviderLabel ?? "").trim()) {+ return nextProviderLabel;+ }+ return currentName;+}