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") {
|
||||
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,
|
||||
};
|
||||
})
|
||||
.filter(Boolean)
|
||||
.filter((item): item is NonNullable<typeof item> => item != null)
|
||||
: [];
|
||||
|
||||
const answerKey = Array.isArray(o.answerKey ?? o.answer_key)
|
||||
? (o.answerKey ?? o.answer_key as unknown[])
|
||||
const answerKeyRaw = o.answerKey ?? o.answer_key;
|
||||
const answerKey = Array.isArray(answerKeyRaw)
|
||||
? (answerKeyRaw as unknown[])
|
||||
.map((entry, idx) => {
|
||||
if (!entry || typeof entry !== "object") return null;
|
||||
const e = entry as Record<string, unknown>;
|
||||
@@ -226,7 +227,7 @@ export function normalizeTeacherPayload(data: unknown): unknown {
|
||||
explanation: extractText(e.explanation) || undefined,
|
||||
};
|
||||
})
|
||||
.filter(Boolean)
|
||||
.filter((item): item is NonNullable<typeof item> => item != null)
|
||||
: quiz.map((q, i) => ({
|
||||
questionIndex: i,
|
||||
answer: q.answerText ?? String(q.answer),
|
||||
|
||||
@@ -65,7 +65,10 @@ export async function saveAiBehaviorConfig(userId: string, config: Partial<AIBeh
|
||||
|
||||
export async function saveAiProviderSettings(
|
||||
userId: string,
|
||||
config: Partial<AIProviderSettings>
|
||||
config: {
|
||||
machineMode?: AIMachineMode;
|
||||
profiles?: Partial<AIProviderSettings["profiles"]>;
|
||||
}
|
||||
): Promise<AIProviderSettings> {
|
||||
const current = await getAiProviderSettings(userId);
|
||||
const merged: AIProviderSettings = {
|
||||
@@ -88,11 +91,13 @@ export async function saveAiProviderSettings(
|
||||
|
||||
export async function saveAiProviderConfig(userId: string, config: Partial<AIProviderConfig>) {
|
||||
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, {
|
||||
profiles: {
|
||||
[mode]: { ...current.profiles[mode], ...config },
|
||||
},
|
||||
profiles: { hyper: { ...current.profiles.hyper, ...config } },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ export async function createTeacherLesson(
|
||||
userId,
|
||||
topic,
|
||||
explorationId: input.explorationId,
|
||||
content: storedContent as Record<string, unknown>,
|
||||
content: storedContent as unknown as Record<string, unknown>,
|
||||
status: "active",
|
||||
});
|
||||
return { ...mapTeacherRow({ ...row, content: storedContent as Record<string, unknown> }) };
|
||||
return { ...mapTeacherRow({ ...row, content: storedContent as unknown as Record<string, unknown> }) };
|
||||
}
|
||||
|
||||
export { TeacherAiUnavailableError };
|
||||
|
||||
@@ -27,7 +27,7 @@ export function unwrapTeacherContent(stored: Record<string, unknown>): {
|
||||
const meta = stored[META_KEY] as StoredTeacherMeta | undefined;
|
||||
const { [META_KEY]: _, ...rest } = stored;
|
||||
return {
|
||||
content: rest as TeacherLessonContent,
|
||||
content: rest as unknown as TeacherLessonContent,
|
||||
source: meta?.source,
|
||||
fallbackReason: meta?.fallbackReason,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user