refactor: extract system prompts and add extended prompt for Opus/Haiku 4.5 (#71)

- Extract system prompts to dedicated lib/system-prompts.ts module
- Add extended system prompt (~4000 tokens) for models with higher cache minimums (Opus 4.5, Haiku 4.5)
- Clean up debug logs while preserving informational and cache-related logs
- Improve code formatting and organization in chat route
This commit is contained in:
Dayuan Jiang
2025-12-04 13:26:06 +09:00
committed by GitHub
parent 9d9613a8d1
commit 3534cb13f7
6 changed files with 784 additions and 325 deletions

View File

@@ -21,6 +21,7 @@ interface ModelConfig {
model: any;
providerOptions?: any;
headers?: Record<string, string>;
modelId: string;
}
// Bedrock provider options for Anthropic beta features
@@ -91,7 +92,6 @@ export function getAIModel(): ModelConfig {
// Validate provider credentials
validateProviderCredentials(provider);
// Log initialization for debugging
console.log(`[AI Provider] Initializing ${provider} with model: ${modelId}`);
let model: any;
@@ -191,10 +191,5 @@ export function getAIModel(): ModelConfig {
);
}
// Log if provider options or headers are being applied
if (providerOptions || headers) {
console.log('[AI Provider] Applying provider-specific options/headers');
}
return { model, providerOptions, headers };
return { model, providerOptions, headers, modelId };
}