feat: initialize full-stack architecture with backend routes, database schema, and glassmorphic frontend UI

This commit is contained in:
2026-05-13 00:12:19 +03:00
parent bd73f18d5c
commit 0732acbda5
21 changed files with 1937 additions and 307 deletions

79
backend/routes/ai.py Normal file
View File

@@ -0,0 +1,79 @@
from flask import Blueprint, request, jsonify
from ..middleware import token_required
from ..utils.ai_utils import generate_complaint_text
ai_blueprint = Blueprint('ai', __name__)
@ai_blueprint.route('/ai/generate-complaint', methods=['POST'])
@token_required
def ai_generate_complaint(current_user_id):
"""
Генерация текста претензии с помощью ИИ
---
tags:
- AI
security:
- APIKeyHeader: []
parameters:
- name: body
in: body
required: true
schema:
type: object
properties:
platform:
type: string
violator_article:
type: string
my_article:
type: string
responses:
200:
description: Сгенерированный текст
"""
data = request.json
platform = data.get('platform', 'ozon')
v_art = data.get('violator_article', '')
my_art = data.get('my_article', '')
if not v_art:
return jsonify({"error": "Артикул нарушителя обязателен"}), 400
text = generate_complaint_text(platform, v_art, my_art)
return jsonify({"text": text})
@ai_blueprint.route('/ai/generate-reply', methods=['POST'])
@token_required
def ai_generate_reply(current_user_id):
"""
Генерация ответа на отзыв покупателя
---
tags:
- AI
security:
- APIKeyHeader: []
parameters:
- name: body
in: body
required: true
schema:
type: object
properties:
review_text:
type: string
rating:
type: integer
responses:
200:
description: Сгенерированный ответ
"""
data = request.json
review_text = data.get('review_text', '')
rating = data.get('rating', 5)
if not review_text:
return jsonify({"error": "Текст отзыва обязателен"}), 400
from ..utils.ai_utils import generate_review_reply
text = generate_review_reply(review_text, rating)
return jsonify({"text": text})