2
apps/web/public/sw.js
Executable file → Normal file
2
apps/web/public/sw.js
Executable file → Normal file
File diff suppressed because one or more lines are too long
@@ -430,7 +430,7 @@ function TeacherPageContent() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ResearchAssignmentBlock({ display }: { display: ResearchAssignmentDisplay }) {
|
function ResearchAssignmentBlock({ display }: { display: ResearchAssignmentDisplay }) {
|
||||||
if (display.kind === "string") {
|
if (display.kind === "string") {
|
||||||
return <p className="serif text-sm whitespace-pre-wrap">{display.text}</p>;
|
return <p className="serif text-sm whitespace-pre-wrap">{display.text}</p>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,11 +209,12 @@ export function normalizeTeacherPayload(data: unknown): unknown {
|
|||||||
explanation: explanation || undefined,
|
explanation: explanation || undefined,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter(Boolean)
|
.filter((item): item is NonNullable<typeof item> => item != null)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const answerKey = Array.isArray(o.answerKey ?? o.answer_key)
|
const answerKeyRaw = o.answerKey ?? o.answer_key;
|
||||||
? (o.answerKey ?? o.answer_key as unknown[])
|
const answerKey = Array.isArray(answerKeyRaw)
|
||||||
|
? (answerKeyRaw as unknown[])
|
||||||
.map((entry, idx) => {
|
.map((entry, idx) => {
|
||||||
if (!entry || typeof entry !== "object") return null;
|
if (!entry || typeof entry !== "object") return null;
|
||||||
const e = entry as Record<string, unknown>;
|
const e = entry as Record<string, unknown>;
|
||||||
@@ -226,7 +227,7 @@ export function normalizeTeacherPayload(data: unknown): unknown {
|
|||||||
explanation: extractText(e.explanation) || undefined,
|
explanation: extractText(e.explanation) || undefined,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter(Boolean)
|
.filter((item): item is NonNullable<typeof item> => item != null)
|
||||||
: quiz.map((q, i) => ({
|
: quiz.map((q, i) => ({
|
||||||
questionIndex: i,
|
questionIndex: i,
|
||||||
answer: q.answerText ?? String(q.answer),
|
answer: q.answerText ?? String(q.answer),
|
||||||
|
|||||||
@@ -65,7 +65,10 @@ export async function saveAiBehaviorConfig(userId: string, config: Partial<AIBeh
|
|||||||
|
|
||||||
export async function saveAiProviderSettings(
|
export async function saveAiProviderSettings(
|
||||||
userId: string,
|
userId: string,
|
||||||
config: Partial<AIProviderSettings>
|
config: {
|
||||||
|
machineMode?: AIMachineMode;
|
||||||
|
profiles?: Partial<AIProviderSettings["profiles"]>;
|
||||||
|
}
|
||||||
): Promise<AIProviderSettings> {
|
): Promise<AIProviderSettings> {
|
||||||
const current = await getAiProviderSettings(userId);
|
const current = await getAiProviderSettings(userId);
|
||||||
const merged: AIProviderSettings = {
|
const merged: AIProviderSettings = {
|
||||||
@@ -88,11 +91,13 @@ export async function saveAiProviderSettings(
|
|||||||
|
|
||||||
export async function saveAiProviderConfig(userId: string, config: Partial<AIProviderConfig>) {
|
export async function saveAiProviderConfig(userId: string, config: Partial<AIProviderConfig>) {
|
||||||
const current = await getAiProviderSettings(userId);
|
const current = await getAiProviderSettings(userId);
|
||||||
const mode = current.machineMode;
|
if (current.machineMode === "local") {
|
||||||
|
return saveAiProviderSettings(userId, {
|
||||||
|
profiles: { local: { ...current.profiles.local, ...config } },
|
||||||
|
});
|
||||||
|
}
|
||||||
return saveAiProviderSettings(userId, {
|
return saveAiProviderSettings(userId, {
|
||||||
profiles: {
|
profiles: { hyper: { ...current.profiles.hyper, ...config } },
|
||||||
[mode]: { ...current.profiles[mode], ...config },
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,10 +70,10 @@ export async function createTeacherLesson(
|
|||||||
userId,
|
userId,
|
||||||
topic,
|
topic,
|
||||||
explorationId: input.explorationId,
|
explorationId: input.explorationId,
|
||||||
content: storedContent as Record<string, unknown>,
|
content: storedContent as unknown as Record<string, unknown>,
|
||||||
status: "active",
|
status: "active",
|
||||||
});
|
});
|
||||||
return { ...mapTeacherRow({ ...row, content: storedContent as Record<string, unknown> }) };
|
return { ...mapTeacherRow({ ...row, content: storedContent as unknown as Record<string, unknown> }) };
|
||||||
}
|
}
|
||||||
|
|
||||||
export { TeacherAiUnavailableError };
|
export { TeacherAiUnavailableError };
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export function unwrapTeacherContent(stored: Record<string, unknown>): {
|
|||||||
const meta = stored[META_KEY] as StoredTeacherMeta | undefined;
|
const meta = stored[META_KEY] as StoredTeacherMeta | undefined;
|
||||||
const { [META_KEY]: _, ...rest } = stored;
|
const { [META_KEY]: _, ...rest } = stored;
|
||||||
return {
|
return {
|
||||||
content: rest as TeacherLessonContent,
|
content: rest as unknown as TeacherLessonContent,
|
||||||
source: meta?.source,
|
source: meta?.source,
|
||||||
fallbackReason: meta?.fallbackReason,
|
fallbackReason: meta?.fallbackReason,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user