Add Groq AI provider support

- Add groq-sdk dependency to backend
- Add groq_api_key and groq_model columns to users table
- Implement extractWithGroq, verifyWithGroq, verifyStockStatusWithGroq, arbitrateWithGroq functions
- Add Groq settings to backend routes with test endpoint
- Add Groq provider option to frontend Settings UI with model selection
- Support for llama-3.3-70b-versatile, llama-3.1-8b-instant, mixtral-8x7b-32768, gemma2-9b-it models

Resolves: #26

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Federico Liva 2026-03-04 10:36:36 +01:00
parent 33b944588d
commit eeeb12bc71
10 changed files with 357 additions and 12 deletions

View file

@ -128,6 +128,18 @@ CREATE TABLE IF NOT EXISTS price_history (
recorded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Migration: Add Groq AI columns to users if they don't exist
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'users' AND column_name = 'groq_api_key'
) THEN
ALTER TABLE users ADD COLUMN groq_api_key VARCHAR(255);
ALTER TABLE users ADD COLUMN groq_model VARCHAR(255);
END IF;
END $$;
-- Index for faster price history queries
CREATE INDEX IF NOT EXISTS idx_price_history_product_date
ON price_history(product_id, recorded_at);