log
2026-06-23 f7a532137a3d98e2c0d6fde376387325455f5444
fix: prevent browser caching of config and models APIs
5 files modified
17 ■■■■■ changed files
video-claw/video-claw/backend/api/routers/configuration.py 5 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/backend/api/routers/pipelines.py 4 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/frontend/app/settings/page.tsx 2 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/frontend/components/HomePage.tsx 4 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/frontend/lib/workflowApi.ts 2 ●●●●● patch | view | raw | blame | history
video-claw/video-claw/backend/api/routers/configuration.py
@@ -1,6 +1,6 @@
from typing import Any, Dict
from fastapi import APIRouter
from fastapi import APIRouter, Response
from pydantic import BaseModel, Field
from api.logging_config import apply_access_log_setting, apply_log_level_setting
@@ -14,7 +14,8 @@
@router.get("/api/config")
async def get_config():
async def get_config(response: Response):
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    return {
        "config": Config.as_dict(),
        "path": str(CONFIG_PATH),
video-claw/video-claw/backend/api/routers/pipelines.py
@@ -5,7 +5,7 @@
from urllib.parse import quote
from typing import Optional
from fastapi import APIRouter, BackgroundTasks, HTTPException, Query
from fastapi import APIRouter, BackgroundTasks, HTTPException, Query, Response
from fastapi.responses import HTMLResponse, StreamingResponse
from api.schemas.pipelines import (
@@ -149,11 +149,13 @@
@router.get("/api/models")
async def get_api_models(
    response: Response,
    media_type: Optional[str] = Query(None, pattern="^(image|video)$"),
    model_type: Optional[str] = Query(None, pattern="^(llm|vlm|t2i|i2i|video)$"),
    ability: Optional[str] = Query(None),
    verified_only: bool = False,
):
    response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
    if model_type:
        models = []
        for model in get_models_by_type(model_type):
video-claw/video-claw/frontend/app/settings/page.tsx
@@ -202,7 +202,7 @@
      setLoading(true);
      setError('');
      try {
        const resp = await fetch('/api/config');
        const resp = await fetch('/api/config', { cache: 'no-store' });
        if (!resp.ok) throw new Error('读取配置失败');
        const data = await resp.json();
        setConfig(data.config || {});
video-claw/video-claw/frontend/components/HomePage.tsx
@@ -1,4 +1,4 @@
'use client';
'use client';
import React, { useState, useRef, useEffect } from 'react';
import { Sparkles, Play, Settings2, Clock, ArrowRight, Zap, CheckCircle, Trash2, X, Lock, Globe, ListOrdered, Upload, Loader2 } from 'lucide-react';
@@ -145,7 +145,7 @@
      setConfigLoading(true);
      setConfigError('');
      try {
        const resp = await fetch('/api/config');
        const resp = await fetch('/api/config', { cache: 'no-store' });
        if (!resp.ok) throw new Error('读取默认模型配置失败');
        const data = await resp.json();
        const models = data.config?.models || {};
video-claw/video-claw/frontend/lib/workflowApi.ts
@@ -195,7 +195,7 @@
  if (params.modelType) search.set('model_type', params.modelType);
  if (params.ability) search.set('ability', params.ability);
  if (params.verifiedOnly) search.set('verified_only', 'true');
  const resp = await fetch(`/api/models${search.toString() ? `?${search.toString()}` : ''}`);
  const resp = await fetch(`/api/models${search.toString() ? `?${search.toString()}` : ''}`, { cache: 'no-store' });
  if (!resp.ok) throw new Error('获取模型列表失败');
  const data = await resp.json();
  return data.models || [];