File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7070 npm install
7171 npm run build
7272 working-directory : web/
73+ env :
74+ VITE_TMDB_API_KEY : ${{ secrets.TMDB_API_KEY }}
7375
7476 # ⑤ 上传 Pages 产物
7577 - name : 上传 Pages 产物
Original file line number Diff line number Diff line change 9797 - name : 生成前端数据
9898 run : python -m scripts.render
9999 env :
100- TMDB_API_KEY : ${{ secrets.TMDB_API_KEY }}
101100 LLM_API_KEY : ${{ secrets.LLM_API_KEY }}
102101 LLM_API_BASE : ${{ secrets.LLM_API_BASE }}
103102 LLM_MODEL : ${{ secrets.LLM_MODEL }}
Original file line number Diff line number Diff line change @@ -154,12 +154,6 @@ def run():
154154 _write_json ("monthly_posters.json" , monthly_posters )
155155 print (f"[Render] 已生成 monthly_posters.json({ len (monthly_posters )} 个月)" )
156156
157- # ── TMDB API 配置(前端搜索打分用) ──
158- tmdb_key = os .environ .get ('TMDB_API_KEY' , '' )
159- if tmdb_key :
160- _write_json ("tmdb_config.json" , {"api_key" : tmdb_key })
161- print ("[Render] 已生成 tmdb_config.json" )
162-
163157 # ── 画像 & 推荐数据 ──
164158 try :
165159 from scripts .render_profile import run as render_profile_run
Original file line number Diff line number Diff line change 22// 前端配置 — 按需修改
33// ============================================
44
5- // TMDB API Key(运行时从 data/tmdb_config.json 加载,无需硬编码 )
6- let tmdbApiKey = ''
5+ // TMDB API Key(Vite 构建时通过 VITE_TMDB_API_KEY 注入 )
6+ const tmdbApiKey = import . meta . env ?. VITE_TMDB_API_KEY || ''
77
8- /** 从 tmdb_config.json 加载 API Key(构建时由 render.py 注入) */
9- export async function loadTmdbConfig ( ) {
10- try {
11- const resp = await fetch ( 'data/tmdb_config.json' )
12- if ( resp . ok ) {
13- const cfg = await resp . json ( )
14- tmdbApiKey = cfg . api_key || ''
15- }
16- } catch { /* 静默 */ }
17- // 也支持 Vite env 变量覆盖
18- if ( import . meta. env ?. VITE_TMDB_API_KEY ) {
19- tmdbApiKey = import . meta. env . VITE_TMDB_API_KEY
20- }
21- }
8+ /** 兼容旧调用,无需异步加载 */
9+ export async function loadTmdbConfig ( ) { }
2210
2311export function getTmdbApiKey ( ) {
2412 return tmdbApiKey
You can’t perform that action at this time.
0 commit comments