🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"
TypeScript
Merge remote-tracking branch 'origin/pr-55'
jiangzj0c0639a5c3d2
diff --cc infrastructure/storage/local_storage.goindex 13b8e70,192dc24..ee2760b--- a/infrastructure/storage/local_storage.go+++ b/infrastructure/storage/local_storage.go@@@ -60,28 -58,19 +60,34 @@@ func (s *LocalStorage) GetURL(path strireturn fmt.Sprintf("%s/%s", s.baseURL, path)}+// DownloadResult 下载结果,包含URL和相对路径+type DownloadResult struct {+ URL string // 完整的访问URL+ RelativePath string // 相对于basePath的路径,用于保存到数据库+ AbsolutePath string // 绝对文件路径+}+// DownloadFromURL 从远程URL下载文件到本地存储func (s *LocalStorage) DownloadFromURL(url, category string) (string, error) {+ result, err := s.DownloadFromURLWithPath(url, category)+ if err != nil {+ return "", err+ }+ return result.URL, nil+}++// DownloadFromURLWithPath 从远程URL下载文件到本地存储,返回详细信息+func (s *LocalStorage) DownloadFromURLWithPath(url, category string) (*DownloadResult, error) {+ // CRITICAL FIX: Add HTTP client with timeout to prevent hanging indefinitely+ // Without timeout, the download can hang forever if the remote server is unresponsive+ // 5 minute timeout is reasonable for large video/image files+ client := &http.Client{+ Timeout: 5 * time.Minute,+ }-// 发送HTTP请求下载文件- resp, err := http.Get(url)+ resp, err := client.Get(url)if err != nil {- return "", fmt.Errorf("failed to download file: %w", err)+ return nil, fmt.Errorf("failed to download file: %w", err)}defer resp.Body.Close()