add codex goals settings toggle
This commit is contained in:
@@ -388,6 +388,10 @@ export interface FastModeSnapshot {
|
||||
claude: boolean;
|
||||
}
|
||||
|
||||
export interface CodexFeatureSnapshot {
|
||||
goals: boolean;
|
||||
}
|
||||
|
||||
export interface MoaReferenceStatus {
|
||||
model: string;
|
||||
checkedAt: string;
|
||||
@@ -538,6 +542,34 @@ export async function updateFastMode(
|
||||
return (await response.json()) as FastModeSnapshot;
|
||||
}
|
||||
|
||||
export async function fetchCodexFeatures(): Promise<CodexFeatureSnapshot> {
|
||||
return fetchJson('/api/settings/codex-features');
|
||||
}
|
||||
|
||||
export async function updateCodexFeatures(
|
||||
input: Partial<CodexFeatureSnapshot>,
|
||||
): Promise<CodexFeatureSnapshot> {
|
||||
const response = await fetch('/api/settings/codex-features', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
if (!response.ok) {
|
||||
let msg = `update codex features failed: ${response.status}`;
|
||||
try {
|
||||
const payload = (await response.json()) as { error?: string };
|
||||
if (payload.error) msg = payload.error;
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
throw new Error(msg);
|
||||
}
|
||||
return (await response.json()) as CodexFeatureSnapshot;
|
||||
}
|
||||
|
||||
export async function fetchMoaSettings(): Promise<MoaSettingsSnapshot> {
|
||||
return fetchJson('/api/settings/moa');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user