mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-05-15 10:52:36 +02:00
Add Google Gemini AI support (v1.0.6)
- Add Gemini as new AI provider option alongside Anthropic, OpenAI, Ollama - Support models: Gemini 2.5 Flash Lite (default), Flash, Pro, 3 Flash Preview - Add test API key endpoint to verify connection before saving - Full support for extraction, verification, stock status, and arbitration - Update all version files to 1.0.6 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fb00f5b5b2
commit
617953dcf5
12 changed files with 341 additions and 17 deletions
|
|
@ -40,13 +40,15 @@ export interface NotificationSettings {
|
|||
export interface AISettings {
|
||||
ai_enabled: boolean;
|
||||
ai_verification_enabled: boolean;
|
||||
ai_provider: 'anthropic' | 'openai' | 'ollama' | null;
|
||||
ai_provider: 'anthropic' | 'openai' | 'ollama' | 'gemini' | null;
|
||||
anthropic_api_key: string | null;
|
||||
anthropic_model: string | null;
|
||||
openai_api_key: string | null;
|
||||
openai_model: string | null;
|
||||
ollama_base_url: string | null;
|
||||
ollama_model: string | null;
|
||||
gemini_api_key: string | null;
|
||||
gemini_model: string | null;
|
||||
}
|
||||
|
||||
export const userQueries = {
|
||||
|
|
@ -231,7 +233,7 @@ export const userQueries = {
|
|||
const result = await pool.query(
|
||||
`SELECT ai_enabled, COALESCE(ai_verification_enabled, false) as ai_verification_enabled,
|
||||
ai_provider, anthropic_api_key, anthropic_model, openai_api_key, openai_model,
|
||||
ollama_base_url, ollama_model
|
||||
ollama_base_url, ollama_model, gemini_api_key, gemini_model
|
||||
FROM users WHERE id = $1`,
|
||||
[id]
|
||||
);
|
||||
|
|
@ -282,6 +284,14 @@ export const userQueries = {
|
|||
fields.push(`ollama_model = $${paramIndex++}`);
|
||||
values.push(settings.ollama_model);
|
||||
}
|
||||
if (settings.gemini_api_key !== undefined) {
|
||||
fields.push(`gemini_api_key = $${paramIndex++}`);
|
||||
values.push(settings.gemini_api_key);
|
||||
}
|
||||
if (settings.gemini_model !== undefined) {
|
||||
fields.push(`gemini_model = $${paramIndex++}`);
|
||||
values.push(settings.gemini_model);
|
||||
}
|
||||
|
||||
if (fields.length === 0) return null;
|
||||
|
||||
|
|
@ -290,7 +300,7 @@ export const userQueries = {
|
|||
`UPDATE users SET ${fields.join(', ')} WHERE id = $${paramIndex}
|
||||
RETURNING ai_enabled, COALESCE(ai_verification_enabled, false) as ai_verification_enabled,
|
||||
ai_provider, anthropic_api_key, anthropic_model, openai_api_key, openai_model,
|
||||
ollama_base_url, ollama_model`,
|
||||
ollama_base_url, ollama_model, gemini_api_key, gemini_model`,
|
||||
values
|
||||
);
|
||||
return result.rows[0] || null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue