fix: streamline gemini flow and add e2e test

This commit is contained in:
2026-03-08 23:58:17 +08:00
parent 82284ce3fb
commit 2ab27eb914
3 changed files with 151 additions and 8 deletions

View File

@@ -24,7 +24,6 @@ GEMINI_API_KEY = os.getenv(
GEMINI_IMAGE_MODEL = os.getenv("GEMINI_IMAGE_MODEL", "gemini-3-pro-image-preview")
GEMINI_IMAGE_SIZE = os.getenv("GEMINI_IMAGE_SIZE", "2K")
GEMINI_PERSON_GENERATION = os.getenv("GEMINI_PERSON_GENERATION", "")
GEMINI_THINKING_LEVEL = os.getenv("GEMINI_THINKING_LEVEL", "MINIMAL")
class GeminiExtractV2Service(BaseService):
@@ -66,7 +65,6 @@ class GeminiExtractV2Service(BaseService):
) -> Dict:
valid_ratios = {"1:1", "9:16", "16:9", "3:4", "4:3", "3:2", "2:3", "5:4", "4:5"}
valid_sizes = {"1K", "2K", "4K"}
valid_thinking = {"MINIMAL", "LOW", "MEDIUM", "HIGH"}
image_config = {}
if aspect_ratio in valid_ratios:
@@ -82,10 +80,6 @@ class GeminiExtractV2Service(BaseService):
if image_config:
generation_config["imageConfig"] = image_config
thinking_val = (thinking_level or GEMINI_THINKING_LEVEL or "").upper().strip()
if thinking_val in valid_thinking:
generation_config["thinkingConfig"] = {"thinkingLevel": thinking_val}
return generation_config
@staticmethod