diff --git a/.gitattributes b/.gitattributes index dfe0770..d5a8c65 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ # Auto detect text files and perform LF normalization * text=auto + diff --git a/app/api/v1/images.py b/app/api/v1/images.py index b9f6c45..b9c191e 100644 --- a/app/api/v1/images.py +++ b/app/api/v1/images.py @@ -29,11 +29,11 @@ async def get_image(img_path: str): if is_video: # 检查视频缓存 - cache_path = video_cache_service.get_cached_video(original_path) + cache_path = video_cache_service.get_cached(original_path) media_type = "video/mp4" else: # 检查图片缓存 - cache_path = image_cache_service.get_cached_image(original_path) + cache_path = image_cache_service.get_cached(original_path) media_type = "image/jpeg" if cache_path and cache_path.exists(): diff --git a/app/services/grok/processer.py b/app/services/grok/processer.py index 66de9fc..f671a55 100644 --- a/app/services/grok/processer.py +++ b/app/services/grok/processer.py @@ -348,6 +348,9 @@ class GrokResponseProcessor: # 获取图片返回模式 image_mode = setting.global_config.get("image_mode", "url") + # 初始化内容变量 + content = "" + # 生成图片链接并缓存 for img in model_resp.get("generatedImageUrls", []): try: @@ -406,6 +409,8 @@ class GrokResponseProcessor: except Exception as e: logger.warning(f"[Processor] 处理图片失败: {e}") content += f"![Generated Image](https://assets.grok.com/{img})\n" + + # 发送内容 yield make_chunk(content.strip(), "stop") timeout_manager.mark_chunk_received() return