fix: render growth homepage without redirect
All checks were successful
CD Pipeline / deploy (push) Successful in 1m7s

This commit is contained in:
ogt
2026-06-24 23:55:25 +08:00
parent 3057c73e0f
commit ef12c1d356
5 changed files with 12 additions and 8 deletions

View File

@@ -402,7 +402,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
# ==========================================
# 系統版本與路徑
# ==========================================
SYSTEM_VERSION = "V10.654"
SYSTEM_VERSION = "V10.655"
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
public_url = PUBLIC_URL # 用於模板顯示

View File

@@ -87,8 +87,9 @@
- V10.649 起 `/ai_intelligence` 必須提供銷售策略建議看板,把商品分成價格防守、主推曝光、組合/單位價、資料補齊等營運路徑;每張策略卡需顯示件數、近 7 天業績、代表商品與可點擊下一步,點擊後必須切到對應商品明細。
- V10.650 起 `/ai_intelligence` 必須提供「今日策略動作」清單,從作戰商品中挑出前 5 件具體行動;每列需顯示處理順序、動作、商品、近 7 天業績、原因與可點擊的詳情/處理入口,避免使用者只看到分類與策略後仍不知道下一步要做哪一件商品。
- V10.651 起從「今日策略動作」或其他非明細列入口打開單品作戰詳情時,商品明細列表中的對應商品仍必須標示為目前選取;使用者需能看出詳情與明細列的關聯。
- V10.652 起正式首頁 `/` 必須導向「PChome 業績成長自動化作戰系統」,舊商品看板僅保留在 `/dashboard``/product-dashboard`;「今日策略動作」必須放在首屏任務摘要後方,不能只藏在商品明細區;每列必須直接顯示價格證據,至少包含 PChome、MOMO、差距與可信度四格。候選待確認或缺資料時需以待確認/待補呈現,不得要求使用者先打開詳情才知道判斷依據。
- V10.654 起全站側邊欄第一個主入口必須命名為「業績成長指揮台」並直連 `/ai_intelligence`;舊商品看板只能以「舊商品看板」保留在 `/dashboard`,比價工作台必須直連 `/dashboard?filter=pchome_review...`,不得再使用 `/` query 轉址,避免正式首頁與舊頁混淆。
- V10.652 起正式首頁 `/` 必須顯示「PChome 業績成長自動化作戰系統」,舊商品看板僅保留在 `/dashboard``/product-dashboard`;「今日策略動作」必須放在首屏任務摘要後方,不能只藏在商品明細區;每列必須直接顯示價格證據,至少包含 PChome、MOMO、差距與可信度四格。候選待確認或缺資料時需以待確認/待補呈現,不得要求使用者先打開詳情才知道判斷依據。
- V10.654 起全站側邊欄第一個主入口必須命名為「業績成長指揮台」;舊商品看板只能以「舊商品看板」保留在 `/dashboard`,比價工作台必須直連 `/dashboard?filter=pchome_review...`,不得再使用 `/` query 轉址,避免正式首頁與舊頁混淆。
- V10.655 起正式首頁 `/` 必須以 HTTP 200 原地渲染「業績成長指揮台」,不得 302 跳轉到 `/ai_intelligence`;側邊欄第一個主入口必須直連 `/``/ai_intelligence` 只作為相容入口保留,不得成為主導流路由。
## 零之一、12 Agent 決策信封2026-05-24

View File

@@ -15,7 +15,7 @@ import pickle
import threading
from datetime import datetime, timezone, timedelta
from types import SimpleNamespace
from flask import Blueprint, request, render_template, jsonify, redirect, url_for
from flask import Blueprint, request, render_template, jsonify
from sqlalchemy import func, and_, text, bindparam
from sqlalchemy.orm import joinedload
@@ -2625,7 +2625,7 @@ def get_pchome_review_queue_api():
@login_required
def index():
"""正式首頁PChome 業績成長自動化作戰系統。"""
return redirect(url_for('ai.ai_intelligence'))
return render_template('ai_intelligence.html', active_page='ai_intelligence')
@dashboard_bp.route('/dashboard')

View File

@@ -49,7 +49,7 @@
{# 群組 1: 作戰caramel #}
<div class="momo-nav-group">
<div class="momo-nav-group-title">作戰</div>
<a class="momo-nav-link {% if _is_growth_command %}is-active{% endif %}" href="/ai_intelligence">
<a class="momo-nav-link {% if _is_growth_command %}is-active{% endif %}" href="/">
<span class="momo-nav-icon"><i class="fas fa-chart-line"></i></span>
<span class="momo-nav-label">業績成長指揮台</span>
<span class="momo-nav-code">01</span>

View File

@@ -507,7 +507,9 @@ def test_formal_homepage_routes_to_growth_command_center():
route_source = Path("routes/dashboard_routes.py").read_text(encoding="utf-8")
assert "@dashboard_bp.route('/')" in route_source
assert "url_for('ai.ai_intelligence')" in route_source
assert "render_template('ai_intelligence.html', active_page='ai_intelligence')" in route_source
assert "return redirect" not in route_source
assert "url_for('ai.ai_intelligence')" not in route_source
assert "@dashboard_bp.route('/dashboard')" in route_source
assert "@dashboard_bp.route('/product-dashboard')" in route_source
@@ -518,7 +520,8 @@ def test_sidebar_uses_growth_command_center_as_primary_entry():
shell = Path("templates/components/_ewoooc_shell.html").read_text(encoding="utf-8")
base = Path("templates/ewoooc_base.html").read_text(encoding="utf-8")
assert 'href="/ai_intelligence"' in shell
assert 'href="/"' in shell
assert 'href="/ai_intelligence"' not in shell
assert "業績成長指揮台" in shell
assert "舊商品看板" in shell
assert 'href="/dashboard?filter=pchome_review' in shell