🧠 Embedding Service API
GET /health
Kontrola stavu služby
Response:
{
"status": "healthy",
"service": "embedding-service",
"model": 256,
"qdrant_collections": 1
}
POST /search
Vyhledávání produktů podle textového dotazu
Request Body:
| Parametr |
Typ |
Povinný |
Popis |
| text |
string |
✓ |
Vyhledávací dotaz |
| limit |
integer |
○ |
Počet výsledků (default: 5, max: 20) |
{
"text": "mobilní telefon",
"limit": 5
}
Response:
{
"results": [
{
"id": "uuid",
"score": 0.85,
"payload": {
"productname": "iPhone 14",
"description": "Popis produktu",
"price_vat": "24990 Kč",
"manufacturer": "Apple",
"categorytext": "Mobily",
"url": "https://eshop.cz/produkt"
}
}
],
"query": "mobilní telefon",
"limit": 5
}
POST /n8n/search
Specializovaný endpoint pro n8n - formátovaná odpověď
Request Body:
| Parametr |
Typ |
Povinný |
Popis |
| message |
string |
✓ |
Zpráva od uživatele |
| limit |
integer |
○ |
Počet výsledků (default: 3) |
{
"message": "hledám notebook do 20000 Kč",
"limit": 3
}
Response:
{
"status": "success",
"message": "hledám notebook do 20000 Kč",
"products": [
{
"productname": "Lenovo ThinkPad",
"description": "Popis notebooku",
"price_vat": "18990 Kč",
"categorytext": "Notebooky",
"manufacturer": "Lenovo",
"url": "https://eshop.cz/notebook",
"score": 0.92
}
],
"count": 1
}
POST /embed
Vytvoření a uložení embeddingu pro nový produkt
Request Body:
{
"text": "iPhone 14 Pro Max 128GB Space Black",
"productname": "iPhone 14 Pro Max",
"price_vat": "32990 Kč",
"manufacturer": "Apple",
"categorytext": "Mobily a telefony",
"url": "https://eshop.cz/iphone-14-pro-max"
}
Response:
{
"status": "success",
"embedding_dimension": 256,
"point_id": "550e8400-e29b-41d4-a716-446655440000"
}
⚙️ XML Processor API
GET /health
Kontrola stavu XML processoru
Response:
{
"status": "healthy",
"service": "xml-processor"
}
POST /process
Spuštění zpracování XML feedu
Request Body:
| Parametr |
Typ |
Povinný |
Popis |
| xml_url |
string |
○ |
URL XML feedu (default: ESL feed) |
| max_items |
integer |
○ |
Max produktů ke zpracování |
{
"max_items": 100
}
Response:
{
"status": "success",
"processed_items": 2332,
"skipped_items": 0,
"processing_time": "45.2s",
"message": "Zpracování XML feedu dokončeno"
}
📊 Dashboard API
GET /api/proxy
Proxy pro volání internal služeb z frontend
Query Parameters:
| Parametr |
Popis |
Příklad |
| url |
Target URL |
http://localhost:8001/health |
POST /api/search
Proxy pro n8n search endpoint
Request Body:
{
"message": "dotaz uživatele",
"limit": 5
}
GET /api/qdrant-stats
Statistiky Qdrant databáze
Response:
{
"collections": [
{
"name": "heureka_products",
"points_count": 2332,
"segments_count": 4,
"status": "green"
}
]
}
💡 Příklady použití
Python
import requests
# Vyhledávání produktů
response = requests.post(
'http://localhost:8085/api/search',
json={
'message': 'notebook Lenovo',
'limit': 5
}
)
data = response.json()
for product in data['products']:
print(f"{product['productname']} - {product['price_vat']}")
JavaScript/Node.js
const axios = require('axios');
async function searchProducts(query) {
try {
const response = await axios.post('http://localhost:8085/api/search', {
message: query,
limit: 3
});
return response.data.products;
} catch (error) {
console.error('Chyba při vyhledávání:', error.message);
return [];
}
}
// Použití
searchProducts('mobilní telefon Samsung').then(products => {
console.log('Nalezené produkty:', products);
});
cURL
# Vyhledávání
curl -X POST "http://localhost:8085/api/search" \
-H "Content-Type: application/json" \
-d '{"message": "herní sluchátka", "limit": 3}'
# Health check
curl -X GET "http://localhost:8085/api/proxy?url=http://localhost:8001/health"
# Zpracování XML
curl -X POST "http://localhost:8085/api/process-xml" \
-H "Content-Type: application/json" \
-d '{"max_items": 100}'