mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 07:42:23 +00:00
refactor(insights): use provider abstraction in settings and generate routes
Replace direct OpenAI API calls with resolveProvider() abstraction. Settings route now returns codexStatus/codexConnectedAt/hasAdminKey instead of hasKey. Generate route validates AI response with insightResultSchema and logs providerType/model. Also fixes AppSettings lookup id from 1 to "singleton" in provider.ts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fde3a0941a
commit
249a2c74ba
3 files changed
+46
-115
No files matched your search
@@ -18,7 +18,7 @@ class NoProvider implements AIProvider {
|
||||
}
|
||||
|
||||
async function resolveAdminProvider(): Promise<AIProvider> {
|
||||
const settings = await prisma.appSettings.findUnique({ where: { id: 1 } });
|
||||
const settings = await prisma.appSettings.findUnique({ where: { id: "singleton" } });
|
||||
|
||||
if (settings?.adminAiKeyEncrypted) {
|
||||
return new OpenAIClient({
|
||||
|
||||
Reference in new issue
Block a user