mirror of
https://github.com/willchen96/mike.git
synced 2026-07-26 23:51:08 +02:00
Modal, header, mobile display and workflow UI updates
This commit is contained in:
parent
8a2dc05181
commit
3132e04ac0
34 changed files with 1635 additions and 1076 deletions
|
|
@ -11,6 +11,7 @@ import { getUserApiKeys as getStoredUserApiKeys } from "./userApiKeys";
|
|||
export type UserModelSettings = {
|
||||
title_model: string;
|
||||
tabular_model: string;
|
||||
legal_research_us: boolean;
|
||||
api_keys: UserApiKeys;
|
||||
};
|
||||
|
||||
|
|
@ -32,7 +33,7 @@ export async function getUserModelSettings(
|
|||
const client = db ?? createServerSupabase();
|
||||
const { data } = await client
|
||||
.from("user_profiles")
|
||||
.select("title_model, tabular_model")
|
||||
.select("title_model, tabular_model, legal_research_us")
|
||||
.eq("user_id", userId)
|
||||
.single();
|
||||
const api_keys = await getStoredUserApiKeys(userId, client);
|
||||
|
|
@ -40,6 +41,9 @@ export async function getUserModelSettings(
|
|||
return {
|
||||
title_model: resolveModel(data?.title_model, resolveTitleModel(api_keys)),
|
||||
tabular_model: resolveModel(data?.tabular_model, DEFAULT_TABULAR_MODEL),
|
||||
legal_research_us:
|
||||
(data as { legal_research_us?: boolean | null } | null)
|
||||
?.legal_research_us !== false,
|
||||
api_keys,
|
||||
};
|
||||
}
|
||||
|
|
@ -51,31 +55,3 @@ export async function getUserApiKeys(
|
|||
const client = db ?? createServerSupabase();
|
||||
return getStoredUserApiKeys(userId, client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the user has US legal research (CourtListener) tools enabled in
|
||||
* chat. Controlled by the Features > Legal Research > Jurisdiction > US
|
||||
* toggle in account settings. Defaults to enabled — both when the user has
|
||||
* no profile row yet and when the column is missing (migration not applied),
|
||||
* so existing behaviour is preserved on partially-migrated deployments.
|
||||
*/
|
||||
export async function getLegalResearchUsEnabled(
|
||||
userId: string,
|
||||
db?: ReturnType<typeof createServerSupabase>,
|
||||
): Promise<boolean> {
|
||||
const client = db ?? createServerSupabase();
|
||||
try {
|
||||
const { data, error } = await client
|
||||
.from("user_profiles")
|
||||
.select("legal_research_us")
|
||||
.eq("user_id", userId)
|
||||
.maybeSingle();
|
||||
if (error || !data) return true;
|
||||
return (
|
||||
(data as { legal_research_us?: boolean | null })
|
||||
.legal_research_us !== false
|
||||
);
|
||||
} catch {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue