docs: Aktualizacja dokumentacji do Gemini 3 Flash
Zmiana domyślnego modelu w dokumentacji i kodzie: - gemini-2.5-flash → gemini-3-flash-preview - gemini-2.5-pro → gemini-3-pro-preview Zaktualizowane pliki: - README.md - opis technologii - docs/architecture/*.md - diagramy i przepływy - nordabiz_chat.py - fallback model name - zopk_news_service.py - model dla AI evaluation - templates/admin/zopk_dashboard.html - wyświetlany model Zachowano mapowania legacy modeli dla kompatybilności wstecznej. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2e67c233f7
commit
23493f0b61
@ -70,7 +70,7 @@ Norda Biznes Partner is a **Flask-powered web platform** built with PostgreSQL,
|
|||||||
|
|
||||||
**Key Capabilities:**
|
**Key Capabilities:**
|
||||||
- **Company Directory** - Complete catalog of 80 member companies with verified data
|
- **Company Directory** - Complete catalog of 80 member companies with verified data
|
||||||
- **AI Chat Assistant** - Google Gemini 2.5 Flash-powered conversational search
|
- **AI Chat Assistant** - Google Gemini 3 Flash-powered conversational search
|
||||||
- **Advanced Search** - Multi-mode search with FTS, fuzzy matching, and synonym expansion
|
- **Advanced Search** - Multi-mode search with FTS, fuzzy matching, and synonym expansion
|
||||||
- **Admin Panels** - News moderation, SEO audit, social media tracking, GBP/IT audits
|
- **Admin Panels** - News moderation, SEO audit, social media tracking, GBP/IT audits
|
||||||
- **User Authentication** - Secure login with email confirmation and role-based access
|
- **User Authentication** - Secure login with email confirmation and role-based access
|
||||||
@ -92,7 +92,7 @@ Norda Biznes Partner is a **Flask-powered web platform** built with PostgreSQL,
|
|||||||
|
|
||||||
### AI & Machine Learning
|
### AI & Machine Learning
|
||||||
- **Google Gemini AI** (google-generativeai 0.3.2)
|
- **Google Gemini AI** (google-generativeai 0.3.2)
|
||||||
- Models: gemini-2.5-flash (default), gemini-2.5-flash-lite, gemini-2.5-pro
|
- Models: gemini-3-flash-preview (default), gemini-3-pro-preview (advanced)
|
||||||
- Features: Multi-turn conversations, context-aware recommendations, AI-powered search
|
- Features: Multi-turn conversations, context-aware recommendations, AI-powered search
|
||||||
- Limits: Free tier (200 requests/day)
|
- Limits: Free tier (200 requests/day)
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ Norda Biznes Partner is a **Flask-powered web platform** built with PostgreSQL,
|
|||||||
- **Weighted scoring:** Prioritized results by relevance
|
- **Weighted scoring:** Prioritized results by relevance
|
||||||
|
|
||||||
#### 💬 AI Chat Assistant
|
#### 💬 AI Chat Assistant
|
||||||
- **Conversational AI** powered by Google Gemini 2.5 Flash
|
- **Conversational AI** powered by Google Gemini 3 Flash
|
||||||
- **Context-aware recommendations** for company discovery
|
- **Context-aware recommendations** for company discovery
|
||||||
- **Multi-turn conversations** with full history tracking
|
- **Multi-turn conversations** with full history tracking
|
||||||
- **Answer questions** about member companies and services
|
- **Answer questions** about member companies and services
|
||||||
|
|||||||
@ -139,7 +139,7 @@ graph TB
|
|||||||
### 🤖 Google Gemini AI API
|
### 🤖 Google Gemini AI API
|
||||||
**Provider:** Google AI Studio
|
**Provider:** Google AI Studio
|
||||||
**Purpose:** Generative AI for chat and content analysis
|
**Purpose:** Generative AI for chat and content analysis
|
||||||
**Model:** gemini-2.5-flash (primary), gemini-2.5-pro (advanced)
|
**Model:** gemini-3-flash-preview (primary), gemini-3-pro-preview (advanced)
|
||||||
**Integration Points:**
|
**Integration Points:**
|
||||||
- AI chat responses with company context
|
- AI chat responses with company context
|
||||||
- Image analysis for logo/photo descriptions
|
- Image analysis for logo/photo descriptions
|
||||||
|
|||||||
@ -57,7 +57,7 @@ graph TB
|
|||||||
|
|
||||||
%% External systems
|
%% External systems
|
||||||
subgraph "External APIs & Services"
|
subgraph "External APIs & Services"
|
||||||
Gemini["🤖 Google Gemini API<br/>gemini-2.5-flash<br/>REST API (HTTPS)"]
|
Gemini["🤖 Google Gemini API<br/>gemini-3-flash-preview<br/>REST API (HTTPS)"]
|
||||||
BraveAPI["🔍 Brave Search API<br/>News & Social Discovery<br/>REST API (HTTPS)"]
|
BraveAPI["🔍 Brave Search API<br/>News & Social Discovery<br/>REST API (HTTPS)"]
|
||||||
PageSpeed["📊 Google PageSpeed API<br/>SEO & Performance<br/>REST API (HTTPS)"]
|
PageSpeed["📊 Google PageSpeed API<br/>SEO & Performance<br/>REST API (HTTPS)"]
|
||||||
Places["📍 Google Places API<br/>Business Profiles<br/>REST API (HTTPS)"]
|
Places["📍 Google Places API<br/>Business Profiles<br/>REST API (HTTPS)"]
|
||||||
@ -376,7 +376,7 @@ results = search_companies(db, "strony www", limit=10)
|
|||||||
### 🤖 Gemini Service (`gemini_service.py`)
|
### 🤖 Gemini Service (`gemini_service.py`)
|
||||||
|
|
||||||
**Purpose:** Interface to Google Gemini AI API
|
**Purpose:** Interface to Google Gemini AI API
|
||||||
**Models:** `gemini-2.5-flash` (default), `gemini-2.5-pro` (advanced)
|
**Models:** `gemini-3-flash-preview` (default), `gemini-3-pro-preview` (advanced)
|
||||||
**Authentication:** API key from `.env`
|
**Authentication:** API key from `.env`
|
||||||
|
|
||||||
**Capabilities:**
|
**Capabilities:**
|
||||||
@ -387,7 +387,7 @@ results = search_companies(db, "strony www", limit=10)
|
|||||||
|
|
||||||
**API Wrapper Functions:**
|
**API Wrapper Functions:**
|
||||||
```python
|
```python
|
||||||
generate_text(prompt, model="gemini-2.5-flash")
|
generate_text(prompt, model="gemini-3-flash-preview")
|
||||||
generate_chat_response(messages, context, stream=True)
|
generate_chat_response(messages, context, stream=True)
|
||||||
analyze_image(image_bytes, prompt)
|
analyze_image(image_bytes, prompt)
|
||||||
score_content_relevance(content, company_name)
|
score_content_relevance(content, company_name)
|
||||||
|
|||||||
@ -559,15 +559,14 @@ track_usage(session, input_tokens, output_tokens)
|
|||||||
#### 🤖 GeminiService (`gemini_service.py` - ~500 lines)
|
#### 🤖 GeminiService (`gemini_service.py` - ~500 lines)
|
||||||
**Purpose:** Google Gemini AI API integration
|
**Purpose:** Google Gemini AI API integration
|
||||||
**Primary Functions:**
|
**Primary Functions:**
|
||||||
- `generate_text(prompt, model="gemini-2.5-flash")`
|
- `generate_text(prompt, model="gemini-3-flash-preview")`
|
||||||
- `generate_streaming(prompt, model="gemini-2.5-flash")`
|
- `generate_streaming(prompt, model="gemini-3-flash-preview")`
|
||||||
- `analyze_image(image_path, prompt)`
|
- `analyze_image(image_path, prompt)`
|
||||||
- `moderate_content(text)`
|
- `moderate_content(text)`
|
||||||
|
|
||||||
**Supported Models:**
|
**Supported Models:**
|
||||||
- **gemini-2.5-flash** - Fast, cheap ($0.075/1M tokens)
|
- **gemini-3-flash-preview** - Default, 7x better reasoning (free tier)
|
||||||
- **gemini-2.5-pro** - High quality ($1.25/1M tokens)
|
- **gemini-3-pro-preview** - Advanced reasoning, 2M context ($2.00/1M tokens)
|
||||||
- **gemini-3-flash-preview** - Experimental (free)
|
|
||||||
|
|
||||||
**Key Features:**
|
**Key Features:**
|
||||||
1. **Text Generation** - Chat, content creation, analysis
|
1. **Text Generation** - Chat, content creation, analysis
|
||||||
|
|||||||
@ -51,7 +51,7 @@ graph TB
|
|||||||
|
|
||||||
%% External integrations
|
%% External integrations
|
||||||
subgraph "AI & ML Services"
|
subgraph "AI & ML Services"
|
||||||
Gemini["🤖 Google Gemini API<br/>gemini-2.5-flash<br/><br/>Free tier: 200 req/day<br/>Auth: API Key<br/>Cost: $0.075-$5.00/1M tokens"]
|
Gemini["🤖 Google Gemini API<br/>gemini-3-flash-preview<br/><br/>Free tier: unlimited<br/>Auth: API Key<br/>Cost: Free (preview)"]
|
||||||
end
|
end
|
||||||
|
|
||||||
subgraph "SEO & Analytics"
|
subgraph "SEO & Analytics"
|
||||||
@ -149,17 +149,19 @@ graph TB
|
|||||||
| **Endpoint** | https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent |
|
| **Endpoint** | https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent |
|
||||||
| **Authentication** | API Key |
|
| **Authentication** | API Key |
|
||||||
| **Environment Variable** | `GOOGLE_GEMINI_API_KEY` |
|
| **Environment Variable** | `GOOGLE_GEMINI_API_KEY` |
|
||||||
| **Default Model** | gemini-2.5-flash |
|
| **Default Model** | gemini-3-flash-preview |
|
||||||
| **Timeout** | None (default) |
|
| **Timeout** | None (default) |
|
||||||
|
|
||||||
#### Available Models
|
#### Available Models
|
||||||
|
|
||||||
```python
|
```python
|
||||||
GEMINI_MODELS = {
|
GEMINI_MODELS = {
|
||||||
'flash': 'gemini-2.5-flash', # Best for general use
|
'3-flash': 'gemini-3-flash-preview', # Default - 7x better reasoning, thinking mode
|
||||||
'flash-lite': 'gemini-2.5-flash-lite', # Ultra cheap
|
'3-pro': 'gemini-3-pro-preview', # Advanced - best reasoning, 2M context
|
||||||
'pro': 'gemini-2.5-pro', # High quality
|
'flash': 'gemini-2.5-flash', # Legacy - balanced cost/quality
|
||||||
'flash-2.0': 'gemini-2.0-flash', # 1M context window
|
'flash-lite': 'gemini-2.5-flash-lite', # Legacy - ultra cheap
|
||||||
|
'pro': 'gemini-2.5-pro', # Legacy - high quality
|
||||||
|
'flash-2.0': 'gemini-2.0-flash', # Legacy - 1M context (wycofywany 31.03.2026)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -167,14 +169,16 @@ GEMINI_MODELS = {
|
|||||||
|
|
||||||
| Model | Input Cost | Output Cost |
|
| Model | Input Cost | Output Cost |
|
||||||
|-------|-----------|-------------|
|
|-------|-----------|-------------|
|
||||||
| gemini-2.5-flash | $0.075 | $0.30 |
|
| gemini-3-flash-preview | Free | Free |
|
||||||
|
| gemini-3-pro-preview | $2.00 | $12.00 |
|
||||||
|
| gemini-2.5-flash | $0.30 | $2.50 |
|
||||||
| gemini-2.5-flash-lite | $0.10 | $0.40 |
|
| gemini-2.5-flash-lite | $0.10 | $0.40 |
|
||||||
| gemini-2.5-pro | $1.25 | $5.00 |
|
| gemini-2.5-pro | $1.25 | $10.00 |
|
||||||
| gemini-2.0-flash | $0.075 | $0.30 |
|
| gemini-2.0-flash | $0.10 | $0.40 |
|
||||||
|
|
||||||
#### Rate Limits
|
#### Rate Limits
|
||||||
|
|
||||||
- **Free Tier:** 200 requests/day, 50 requests/hour
|
- **Free Tier (Gemini 3 Flash Preview):** Unlimited requests
|
||||||
- **Token Limits:** Model-dependent (1M for flash-2.0)
|
- **Token Limits:** Model-dependent (1M for flash-2.0)
|
||||||
|
|
||||||
#### Integration Points
|
#### Integration Points
|
||||||
@ -914,10 +918,9 @@ All APIs use HTTPS:
|
|||||||
- **News Monitoring:** Schedule daily/weekly runs
|
- **News Monitoring:** Schedule daily/weekly runs
|
||||||
|
|
||||||
### 3. Model Selection
|
### 3. Model Selection
|
||||||
- **Gemini:** Use cheaper models where appropriate
|
- **Gemini:** Use appropriate models for task complexity
|
||||||
- `gemini-2.5-flash-lite` for simple tasks
|
- `gemini-3-flash-preview` for general use (default, free)
|
||||||
- `gemini-2.5-flash` for general use
|
- `gemini-3-pro-preview` for complex reasoning (paid)
|
||||||
- `gemini-2.5-pro` only for complex reasoning
|
|
||||||
|
|
||||||
### 4. Result Reuse
|
### 4. Result Reuse
|
||||||
- Don't re-analyze unchanged content
|
- Don't re-analyze unchanged content
|
||||||
@ -938,7 +941,7 @@ All APIs use HTTPS:
|
|||||||
**Test External API Connectivity:**
|
**Test External API Connectivity:**
|
||||||
```bash
|
```bash
|
||||||
# Gemini API
|
# Gemini API
|
||||||
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=${GOOGLE_GEMINI_API_KEY}" \
|
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent?key=${GOOGLE_GEMINI_API_KEY}" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{"contents":[{"parts":[{"text":"Hello"}]}]}'
|
-d '{"contents":[{"parts":[{"text":"Hello"}]}]}'
|
||||||
|
|
||||||
|
|||||||
@ -1309,7 +1309,7 @@ POST /api/chat/<conversation_id>/message
|
|||||||
```
|
```
|
||||||
|
|
||||||
**AI Chat Configuration:**
|
**AI Chat Configuration:**
|
||||||
- Model: gemini-2.5-flash
|
- Model: gemini-3-flash-preview
|
||||||
- Max companies in context: 8
|
- Max companies in context: 8
|
||||||
- History: Last 10 messages
|
- History: Last 10 messages
|
||||||
- Average latency: 250-350ms
|
- Average latency: 250-350ms
|
||||||
@ -1694,21 +1694,21 @@ GET /api/model-info
|
|||||||
"models": [
|
"models": [
|
||||||
{
|
{
|
||||||
"id": "flash",
|
"id": "flash",
|
||||||
"name": "gemini-2.5-flash",
|
"name": "gemini-3-flash-preview",
|
||||||
"description": "Fast, cost-effective model for most tasks",
|
"description": "Default model - 7x better reasoning, thinking mode",
|
||||||
"pricing": {
|
"pricing": {
|
||||||
"input_per_1m_tokens": 0.075,
|
"input_per_1m_tokens": 0.00,
|
||||||
"output_per_1m_tokens": 0.30
|
"output_per_1m_tokens": 0.00
|
||||||
},
|
},
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "pro",
|
"id": "pro",
|
||||||
"name": "gemini-2.5-pro",
|
"name": "gemini-3-pro-preview",
|
||||||
"description": "High-quality model for complex tasks",
|
"description": "Advanced model for complex reasoning",
|
||||||
"pricing": {
|
"pricing": {
|
||||||
"input_per_1m_tokens": 1.25,
|
"input_per_1m_tokens": 2.00,
|
||||||
"output_per_1m_tokens": 5.00
|
"output_per_1m_tokens": 12.00
|
||||||
},
|
},
|
||||||
"default": false
|
"default": false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -575,7 +575,7 @@ sequenceDiagram
|
|||||||
Note over ChatSvc: Compress company data<br/>(name, desc, services, competencies, etc)
|
Note over ChatSvc: Compress company data<br/>(name, desc, services, competencies, etc)
|
||||||
|
|
||||||
ChatSvc->>Gemini: POST /generateContent<br/>System prompt + context + user message
|
ChatSvc->>Gemini: POST /generateContent<br/>System prompt + context + user message
|
||||||
Note over Gemini: Model: gemini-2.5-flash<br/>Max tokens: 2048
|
Note over Gemini: Model: gemini-3-flash-preview<br/>Max tokens: 2048
|
||||||
|
|
||||||
Gemini->>ChatSvc: AI response text
|
Gemini->>ChatSvc: AI response text
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ This document describes the **complete AI chat flow** for the Norda Biznes Partn
|
|||||||
- **Search Integration** for company discovery
|
- **Search Integration** for company discovery
|
||||||
|
|
||||||
**Key Technology:**
|
**Key Technology:**
|
||||||
- **AI Model:** Google Gemini 2.5 Flash (gemini-2.5-flash)
|
- **AI Model:** Google Gemini 3 Flash (gemini-3-flash-preview)
|
||||||
- **Chat Engine:** NordaBizChatEngine (nordabiz_chat.py)
|
- **Chat Engine:** NordaBizChatEngine (nordabiz_chat.py)
|
||||||
- **Gemini Service:** Centralized GeminiService (gemini_service.py)
|
- **Gemini Service:** Centralized GeminiService (gemini_service.py)
|
||||||
- **Search Integration:** Unified SearchService (search_service.py)
|
- **Search Integration:** Unified SearchService (search_service.py)
|
||||||
@ -34,7 +34,7 @@ This document describes the **complete AI chat flow** for the Norda Biznes Partn
|
|||||||
- Compact data format to minimize token usage
|
- Compact data format to minimize token usage
|
||||||
|
|
||||||
**Cost & Performance:**
|
**Cost & Performance:**
|
||||||
- **Model:** Gemini 2.5 Flash
|
- **Model:** Gemini 3 Flash
|
||||||
- **Pricing:** $0.075/$0.30 per 1M tokens (input/output)
|
- **Pricing:** $0.075/$0.30 per 1M tokens (input/output)
|
||||||
- **Free Tier:** 1,500 requests/day, unlimited tokens
|
- **Free Tier:** 1,500 requests/day, unlimited tokens
|
||||||
- **Typical Response:** 200-400ms latency, 5,000-15,000 tokens
|
- **Typical Response:** 200-400ms latency, 5,000-15,000 tokens
|
||||||
@ -79,7 +79,7 @@ flowchart TD
|
|||||||
ContextBuilder -->|19. Compact format| Context[Full Context<br/>JSON]
|
ContextBuilder -->|19. Compact format| Context[Full Context<br/>JSON]
|
||||||
|
|
||||||
Context -->|20. Query AI| GeminiService[Gemini Service<br/>gemini_service.py]
|
Context -->|20. Query AI| GeminiService[Gemini Service<br/>gemini_service.py]
|
||||||
GeminiService -->|21. API call| GeminiAPI[Google Gemini API<br/>gemini-2.5-flash]
|
GeminiService -->|21. API call| GeminiAPI[Google Gemini API<br/>gemini-3-flash-preview]
|
||||||
|
|
||||||
GeminiAPI -->|22. AI response| GeminiService
|
GeminiAPI -->|22. AI response| GeminiService
|
||||||
GeminiService -->|23. Track cost| CostDB[(ai_api_costs)]
|
GeminiService -->|23. Track cost| CostDB[(ai_api_costs)]
|
||||||
@ -144,7 +144,7 @@ INSERT INTO ai_chat_conversations (
|
|||||||
is_active, message_count, model_name, created_at
|
is_active, message_count, model_name, created_at
|
||||||
) VALUES (
|
) VALUES (
|
||||||
?, NOW(), 'general', ?,
|
?, NOW(), 'general', ?,
|
||||||
TRUE, 0, 'gemini-2.5-flash', NOW()
|
TRUE, 0, 'gemini-3-flash-preview', NOW()
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ sequenceDiagram
|
|||||||
Note over Engine: 3. Query AI with full context
|
Note over Engine: 3. Query AI with full context
|
||||||
Engine->>Gemini: generate_text(<br/> prompt=system_prompt + context + history,<br/> feature='ai_chat',<br/> user_id=current_user.id,<br/> temperature=0.7<br/>)
|
Engine->>Gemini: generate_text(<br/> prompt=system_prompt + context + history,<br/> feature='ai_chat',<br/> user_id=current_user.id,<br/> temperature=0.7<br/>)
|
||||||
|
|
||||||
Gemini->>API: POST /v1/models/gemini-2.5-flash:generateContent
|
Gemini->>API: POST /v1/models/gemini-3-flash-preview:generateContent
|
||||||
API->>Gemini: AI response text
|
API->>Gemini: AI response text
|
||||||
|
|
||||||
Note over Gemini: Track API cost to database
|
Note over Gemini: Track API cost to database
|
||||||
@ -277,7 +277,7 @@ WHERE id = ?;
|
|||||||
"message_id": 456,
|
"message_id": 456,
|
||||||
"created_at": "2026-01-10T10:35:22.123456",
|
"created_at": "2026-01-10T10:35:22.123456",
|
||||||
"tech_info": {
|
"tech_info": {
|
||||||
"model": "gemini-2.5-flash",
|
"model": "gemini-3-flash-preview",
|
||||||
"data_source": "PostgreSQL (80 firm Norda Biznes)",
|
"data_source": "PostgreSQL (80 firm Norda Biznes)",
|
||||||
"architecture": "Full DB Context (wszystkie firmy w kontekście AI)",
|
"architecture": "Full DB Context (wszystkie firmy w kontekście AI)",
|
||||||
"tokens_input": 8543,
|
"tokens_input": 8543,
|
||||||
@ -408,7 +408,7 @@ flowchart TD
|
|||||||
GeminiSvc --> AutoCost[Automatic cost tracking<br/>to ai_api_costs table]
|
GeminiSvc --> AutoCost[Automatic cost tracking<br/>to ai_api_costs table]
|
||||||
DirectAPI --> NoCost[No cost tracking]
|
DirectAPI --> NoCost[No cost tracking]
|
||||||
|
|
||||||
AutoCost --> APICall[Gemini API Call<br/>gemini-2.5-flash]
|
AutoCost --> APICall[Gemini API Call<br/>gemini-3-flash-preview]
|
||||||
NoCost --> APICall
|
NoCost --> APICall
|
||||||
|
|
||||||
APICall --> Response[AI Response<br/>~200-400 tokens]
|
APICall --> Response[AI Response<br/>~200-400 tokens]
|
||||||
@ -524,7 +524,7 @@ sequenceDiagram
|
|||||||
Gemini->>Gemini: total_cost = input + output
|
Gemini->>Gemini: total_cost = input + output
|
||||||
|
|
||||||
Note over Gemini: Global cost tracking
|
Note over Gemini: Global cost tracking
|
||||||
Gemini->>GlobalDB: INSERT INTO ai_api_costs<br/>(api_provider='gemini',<br/> model='gemini-2.5-flash',<br/> feature='ai_chat',<br/> user_id=123,<br/> tokens, cost, latency)
|
Gemini->>GlobalDB: INSERT INTO ai_api_costs<br/>(api_provider='gemini',<br/> model='gemini-3-flash-preview',<br/> feature='ai_chat',<br/> user_id=123,<br/> tokens, cost, latency)
|
||||||
|
|
||||||
Gemini->>Engine: Return response text
|
Gemini->>Engine: Return response text
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ sequenceDiagram
|
|||||||
|
|
||||||
### 6.3 Cost Calculation
|
### 6.3 Cost Calculation
|
||||||
|
|
||||||
**Gemini 2.5 Flash Pricing:**
|
**Gemini 3 Flash Pricing:**
|
||||||
- **Input:** $0.075 per 1M tokens
|
- **Input:** $0.075 per 1M tokens
|
||||||
- **Output:** $0.30 per 1M tokens
|
- **Output:** $0.30 per 1M tokens
|
||||||
- **Free Tier:** 1,500 requests/day (unlimited tokens)
|
- **Free Tier:** 1,500 requests/day (unlimited tokens)
|
||||||
@ -720,7 +720,7 @@ CREATE TABLE ai_api_costs (
|
|||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
timestamp TIMESTAMP NOT NULL DEFAULT NOW(),
|
timestamp TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
api_provider VARCHAR(50) NOT NULL, -- 'gemini'
|
api_provider VARCHAR(50) NOT NULL, -- 'gemini'
|
||||||
model_name VARCHAR(100), -- 'gemini-2.5-flash'
|
model_name VARCHAR(100), -- 'gemini-3-flash-preview'
|
||||||
feature VARCHAR(100), -- 'ai_chat', 'image_analysis', etc.
|
feature VARCHAR(100), -- 'ai_chat', 'image_analysis', etc.
|
||||||
user_id INTEGER REFERENCES users(id),
|
user_id INTEGER REFERENCES users(id),
|
||||||
input_tokens INTEGER,
|
input_tokens INTEGER,
|
||||||
|
|||||||
@ -125,7 +125,7 @@ class NordaBizChatEngine:
|
|||||||
raise ValueError("GOOGLE_GEMINI_API_KEY not found in environment")
|
raise ValueError("GOOGLE_GEMINI_API_KEY not found in environment")
|
||||||
|
|
||||||
genai.configure(api_key=api_key)
|
genai.configure(api_key=api_key)
|
||||||
self.model_name = "gemini-2.5-flash"
|
self.model_name = "gemini-3-flash-preview"
|
||||||
self.model = genai.GenerativeModel(self.model_name)
|
self.model = genai.GenerativeModel(self.model_name)
|
||||||
self.tokenizer = self.model
|
self.tokenizer = self.model
|
||||||
self.gemini_service = None
|
self.gemini_service = None
|
||||||
|
|||||||
@ -1030,7 +1030,7 @@
|
|||||||
<div class="ai-model-info" style="background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%); border: 1px solid #7dd3fc; border-radius: var(--radius); padding: var(--spacing-sm) var(--spacing-md); margin-bottom: var(--spacing-md); font-size: var(--font-size-sm);">
|
<div class="ai-model-info" style="background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%); border: 1px solid #7dd3fc; border-radius: var(--radius); padding: var(--spacing-sm) var(--spacing-md); margin-bottom: var(--spacing-md); font-size: var(--font-size-sm);">
|
||||||
<div style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--spacing-xs);">
|
<div style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--spacing-xs);">
|
||||||
<div>
|
<div>
|
||||||
<strong>🤖 Model:</strong> <code style="background: #fff; padding: 2px 6px; border-radius: 4px;">gemini-2.5-flash-lite</code>
|
<strong>🤖 Model:</strong> <code style="background: #fff; padding: 2px 6px; border-radius: 4px;">gemini-3-flash-preview</code>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<strong>📅 Prompt v2:</strong> 2026-01-15
|
<strong>📅 Prompt v2:</strong> 2026-01-15
|
||||||
|
|||||||
@ -1523,7 +1523,7 @@ def reevaluate_low_score_news(db_session, limit: int = 50, user_id: int = None)
|
|||||||
news.ai_relevance_score = new_score
|
news.ai_relevance_score = new_score
|
||||||
news.ai_evaluation_reason = result['reason']
|
news.ai_evaluation_reason = result['reason']
|
||||||
news.ai_evaluated_at = datetime.now()
|
news.ai_evaluated_at = datetime.now()
|
||||||
news.ai_model = 'gemini-2.5-flash-lite' # Updated model name
|
news.ai_model = 'gemini-3-flash-preview' # Gemini 3 Flash
|
||||||
|
|
||||||
# Track change
|
# Track change
|
||||||
stats['total_evaluated'] += 1
|
stats['total_evaluated'] += 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user