mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
Add consent flow for Slack workspace reassignment (#1369)
Co-authored-by: Vorflux AI <249966464+vorflux[bot]@users.noreply.github.com> Co-authored-by: Mahesh Sanikommu <maheshthedev@gmail.com>
This commit is contained in:
parent
95a34602b7
commit
d4377b1609
2 changed files with 45 additions and 15 deletions
|
|
@ -51,11 +51,22 @@ const MODEL_TAGS: Record<string, string> = {
|
|||
}
|
||||
|
||||
const EFFORT_LABELS: Record<BrainReasoningEffort, string> = {
|
||||
auto: "Auto",
|
||||
low: "Low",
|
||||
medium: "Medium",
|
||||
high: "High",
|
||||
xhigh: "Extra high",
|
||||
}
|
||||
const EFFORT_ORDER: BrainReasoningEffort[] = [
|
||||
"auto",
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
"xhigh",
|
||||
]
|
||||
|
||||
const AUTO_EFFORT_HELP =
|
||||
"Automatically adjusts thinking depth for each request."
|
||||
|
||||
const ROWS: {
|
||||
role: BrainModelRole
|
||||
|
|
@ -167,6 +178,11 @@ const CONFIG_KEYS = [
|
|||
const extraHighIsBounded = (model: string): boolean =>
|
||||
model.startsWith("grok-") || model.startsWith("gpt-")
|
||||
|
||||
const orderedEfforts = (
|
||||
options: BrainReasoningEffort[],
|
||||
): BrainReasoningEffort[] =>
|
||||
[...options].sort((a, b) => EFFORT_ORDER.indexOf(a) - EFFORT_ORDER.indexOf(b))
|
||||
|
||||
const controlClass = cn(
|
||||
dmSans125ClassName(),
|
||||
"h-9 w-full rounded-full border border-[#1E293B] bg-[#0D121A] px-3.5 text-[13px] text-[#FAFAFA] outline-none disabled:opacity-50",
|
||||
|
|
@ -209,6 +225,13 @@ export default function CompanyBrainModels({
|
|||
const [draft, setDraft] = useState<Partial<BrainModelConfig>>({})
|
||||
const [advancedOpen, setAdvancedOpen] = useState(false)
|
||||
|
||||
const updateDraft = (patch: Partial<BrainModelConfig>) => {
|
||||
// A saved custom config opens Advanced automatically. Keep it open if an
|
||||
// edit happens to match a preset again, instead of collapsing mid-click.
|
||||
setAdvancedOpen(true)
|
||||
setDraft((currentDraft) => ({ ...currentDraft, ...patch }))
|
||||
}
|
||||
|
||||
const resolved = modelsQuery.data?.resolved
|
||||
const defaults = modelsQuery.data?.defaults
|
||||
const choices = modelsQuery.data?.choices
|
||||
|
|
@ -344,11 +367,21 @@ export default function CompanyBrainModels({
|
|||
</button>
|
||||
|
||||
{advancedOpen || activePresetId === null ? (
|
||||
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
||||
<div className="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
|
||||
{ROWS.map(({ role, effortKey, title, help, effortHelp }) => {
|
||||
const options = choices?.[role] ?? []
|
||||
const current = valueFor(role)
|
||||
const effortOptions = choices?.[effortKey] ?? []
|
||||
const availableEfforts = choices?.[effortKey] ?? []
|
||||
const effortOptions = orderedEfforts(
|
||||
role === "main"
|
||||
? [
|
||||
...new Set<BrainReasoningEffort>([
|
||||
"auto",
|
||||
...availableEfforts,
|
||||
]),
|
||||
]
|
||||
: availableEfforts.filter((effort) => effort !== "auto"),
|
||||
)
|
||||
const currentEffort = effortFor(effortKey)
|
||||
const isDefault =
|
||||
defaults?.[role] === current &&
|
||||
|
|
@ -395,9 +428,7 @@ export default function CompanyBrainModels({
|
|||
<Select
|
||||
value={current}
|
||||
disabled={disabled}
|
||||
onValueChange={(v) =>
|
||||
setDraft((d) => ({ ...d, [role]: v }))
|
||||
}
|
||||
onValueChange={(v) => updateDraft({ [role]: v })}
|
||||
>
|
||||
<SelectTrigger className={controlClass}>
|
||||
<SelectValue placeholder="Select a model…" />
|
||||
|
|
@ -436,14 +467,12 @@ export default function CompanyBrainModels({
|
|||
aria-pressed={isOn}
|
||||
disabled={disabled}
|
||||
onClick={() =>
|
||||
setDraft((currentDraft) => ({
|
||||
...currentDraft,
|
||||
[effortKey]: effort,
|
||||
}))
|
||||
updateDraft({ [effortKey]: effort })
|
||||
}
|
||||
className={cn(
|
||||
dmSans125ClassName(),
|
||||
"h-7 min-w-0 flex-1 cursor-pointer rounded-full px-1 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
||||
"h-7 min-w-0 cursor-pointer whitespace-nowrap rounded-full px-1.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",
|
||||
effort === "xhigh" ? "flex-[1.35]" : "flex-1",
|
||||
isOn
|
||||
? "bg-white/[0.10] text-[#FAFAFA]"
|
||||
: "text-[#8B929E] hover:text-[#FAFAFA]",
|
||||
|
|
@ -454,9 +483,8 @@ export default function CompanyBrainModels({
|
|||
)
|
||||
})}
|
||||
</div>
|
||||
<div className="flex items-center justify-between px-1.5 text-[10px] font-medium text-[#4A5260]">
|
||||
<span>Faster</span>
|
||||
<span>Smarter</span>
|
||||
<div className="px-1.5 text-center text-[10px] font-medium text-[#4A5260]">
|
||||
Manual: faster → smarter
|
||||
</div>
|
||||
<p
|
||||
className={cn(
|
||||
|
|
@ -464,7 +492,9 @@ export default function CompanyBrainModels({
|
|||
"text-[11px] leading-[1.5] text-[#5F6673]",
|
||||
)}
|
||||
>
|
||||
{effortHelp}
|
||||
{role === "main" && currentEffort === "auto"
|
||||
? AUTO_EFFORT_HELP
|
||||
: effortHelp}
|
||||
</p>
|
||||
{currentEffort === "xhigh" &&
|
||||
extraHighIsBounded(current) ? (
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const BACKEND =
|
|||
const BASE = `${BACKEND}/brain/models`
|
||||
|
||||
export type BrainModelRole = "main" | "triage" | "research"
|
||||
export type BrainReasoningEffort = "low" | "medium" | "high" | "xhigh"
|
||||
export type BrainReasoningEffort = "auto" | "low" | "medium" | "high" | "xhigh"
|
||||
export type BrainReasoningKey = "mainEffort" | "triageEffort" | "researchEffort"
|
||||
|
||||
export type BrainModelConfig = Record<BrainModelRole, string> &
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue