Fix V3 shell active states
All checks were successful
CD Pipeline / deploy (push) Successful in 1m3s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m3s
This commit is contained in:
@@ -320,7 +320,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
|
||||
# ==========================================
|
||||
# 系統版本與路徑
|
||||
# ==========================================
|
||||
SYSTEM_VERSION = "V10.179"
|
||||
SYSTEM_VERSION = "V10.180"
|
||||
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
|
||||
public_url = PUBLIC_URL # 用於模板顯示
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ def ai_recommend():
|
||||
product_categories = load_product_categories()
|
||||
|
||||
return render_template('ai_recommend.html',
|
||||
active_page='ai_recommend',
|
||||
ai_status=ai_status,
|
||||
ollama_status=ai_status['ollama']['connected'],
|
||||
gemini_status=ai_status['gemini']['connected'],
|
||||
@@ -724,7 +725,7 @@ def api_batch_generate_copy():
|
||||
@login_required
|
||||
def ai_history_page():
|
||||
"""AI 歷史記錄頁面"""
|
||||
return render_template('ai_history.html')
|
||||
return render_template('ai_history.html', active_page='ai_history')
|
||||
|
||||
|
||||
@ai_bp.route('/api/ai/history')
|
||||
|
||||
@@ -331,7 +331,7 @@ def ai_automation_smoke_daily_summary_send():
|
||||
|
||||
@system_public_bp.route('/logs')
|
||||
def show_logs():
|
||||
return render_template('logs.html')
|
||||
return render_template('logs.html', active_page='logs')
|
||||
|
||||
|
||||
@system_public_bp.route('/api/logs')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends 'ewoooc_base.html' %}
|
||||
{% block title %}AI 生成歷史 - WOOO TECH{% endblock %}
|
||||
{% block title %}AI 生成歷史 · EwoooC{% endblock %}
|
||||
|
||||
{% block ewooo_content %}
|
||||
<div class="ai-history-page">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends 'ewoooc_base.html' %}
|
||||
{% block title %}AI 競情中樞 - WOOO TECH{% endblock %}
|
||||
{% block title %}AI 競情中樞 · EwoooC{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends 'ewoooc_base.html' %}
|
||||
{% block title %}AI 智慧推薦 - WOOO TECH{% endblock %}
|
||||
{% block title %}AI 智慧推薦 · EwoooC{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/page-ai-recommend.css') }}">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends 'ewoooc_base.html' %}
|
||||
|
||||
{% block title %}系統日誌 - WOOO TECH{% endblock %}
|
||||
{% block title %}系統日誌 · EwoooC{% endblock %}
|
||||
{% block page_accent %}observability{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
|
||||
@@ -211,7 +211,7 @@ def test_ai_history_uses_v2_shell_and_real_history_apis():
|
||||
assert "假商品" not in template
|
||||
|
||||
assert "@ai_bp.route('/ai_history')" in route_source
|
||||
assert "render_template('ai_history.html')" in route_source
|
||||
assert "render_template('ai_history.html', active_page='ai_history')" in route_source
|
||||
assert "@ai_bp.route('/api/ai/history')" in route_source
|
||||
assert "ai_history_service.get_history_list" in route_source
|
||||
assert "ai_history_service.get_statistics" in route_source
|
||||
@@ -238,6 +238,7 @@ def test_ai_recommend_uses_v2_shell_and_runtime_category_data():
|
||||
|
||||
assert "@ai_bp.route('/ai_recommend')" in route_source
|
||||
assert "render_template('ai_recommend.html'" in route_source
|
||||
assert "active_page='ai_recommend'" in route_source
|
||||
assert "product_categories=product_categories" in route_source
|
||||
assert "@ai_bp.route('/api/ai/generate_copy'" in route_source
|
||||
assert "@ai_bp.route('/api/ai/web_search'" in route_source
|
||||
|
||||
29
tests/test_shell_active_page_contract.py
Normal file
29
tests/test_shell_active_page_contract.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def test_ai_and_system_pages_pass_active_page_to_v3_shell():
|
||||
ai_routes = (ROOT / "routes/ai_routes.py").read_text(encoding="utf-8")
|
||||
system_routes = (ROOT / "routes/system_public_routes.py").read_text(encoding="utf-8")
|
||||
|
||||
assert "render_template('ai_recommend.html'," in ai_routes
|
||||
assert "active_page='ai_recommend'" in ai_routes
|
||||
assert "render_template('ai_history.html', active_page='ai_history')" in ai_routes
|
||||
assert "render_template('ai_intelligence.html', active_page='ai_intelligence')" in ai_routes
|
||||
assert "render_template('logs.html', active_page='logs')" in system_routes
|
||||
|
||||
|
||||
def test_ai_and_logs_titles_use_ewoooc_brand():
|
||||
templates = [
|
||||
ROOT / "templates/ai_recommend.html",
|
||||
ROOT / "templates/ai_intelligence.html",
|
||||
ROOT / "templates/ai_history.html",
|
||||
ROOT / "templates/logs.html",
|
||||
]
|
||||
|
||||
for template_path in templates:
|
||||
source = template_path.read_text(encoding="utf-8")
|
||||
assert "EwoooC" in source
|
||||
assert "WOOO TECH" not in source
|
||||
Reference in New Issue
Block a user