feat: enhanced AI usage logging (model, provider, response) and fixed build blockers
This commit is contained in:
@@ -186,7 +186,10 @@ export async function scanLabel(input: any): Promise<AnalysisResponse> {
|
||||
userId: userId,
|
||||
apiType: 'gemini_ai',
|
||||
endpoint: 'scanLabel_openrouter',
|
||||
success: true
|
||||
success: true,
|
||||
provider: 'openrouter',
|
||||
model: 'google/gemma-3-27b-it',
|
||||
responseText: content
|
||||
});
|
||||
await deductCredits(userId, 'gemini_ai', 'Bottle OCR scan (OpenRouter)');
|
||||
|
||||
@@ -248,7 +251,10 @@ export async function scanLabel(input: any): Promise<AnalysisResponse> {
|
||||
userId: userId,
|
||||
apiType: 'gemini_ai',
|
||||
endpoint: 'scanLabel_gemini',
|
||||
success: true
|
||||
success: true,
|
||||
provider: 'google',
|
||||
model: 'gemini-2.5-flash',
|
||||
responseText: result.response.text()
|
||||
});
|
||||
await deductCredits(userId, 'gemini_ai', 'Bottle OCR scan (Gemini)');
|
||||
|
||||
@@ -279,7 +285,9 @@ export async function scanLabel(input: any): Promise<AnalysisResponse> {
|
||||
apiType: 'gemini_ai',
|
||||
endpoint: `scanLabel_${provider}`,
|
||||
success: false,
|
||||
errorMessage: aiError.message
|
||||
errorMessage: aiError.message,
|
||||
provider: provider,
|
||||
model: provider === 'openrouter' ? 'google/gemma-3-27b-it' : 'gemini-2.5-flash'
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user