Add AMP fallback proxy and shared Gemini normalization

- add fallback handler that forwards Amp provider requests to ampcode.com when the provider isn’t configured locally
- wrap AMP provider routes with the fallback so requests always have a handler
- share Gemini thinking model normalization helper between core handlers and AMP fallback
This commit is contained in:
Ben Vargas
2025-10-24 09:17:12 -06:00
parent 9ad0f3f91e
commit 8193392bfe
4 changed files with 152 additions and 34 deletions

View File

@@ -359,20 +359,7 @@ func cloneBytes(src []byte) []byte {
}
func normalizeModelMetadata(modelName string) (string, map[string]any) {
baseModel, budget, include, matched := util.ParseGeminiThinkingSuffix(modelName)
if !matched {
return baseModel, nil
}
metadata := map[string]any{
util.GeminiOriginalModelMetadataKey: modelName,
}
if budget != nil {
metadata[util.GeminiThinkingBudgetMetadataKey] = *budget
}
if include != nil {
metadata[util.GeminiIncludeThoughtsMetadataKey] = *include
}
return baseModel, metadata
return util.NormalizeGeminiThinkingModel(modelName)
}
func cloneMetadata(src map[string]any) map[string]any {