diff --git a/config.py b/config.py index be1d27c..bb2f48e 100644 --- a/config.py +++ b/config.py @@ -40,6 +40,7 @@ class Config: TRIAL_API = "https://ai.comfly.chat/v1/images/generations" TRIAL_KEY = "sk-Rr8L5noW8Qga7K4jmey3yYZYL1a4SlhlNlo5iZrwqJRK1Pa1" PREMIUM_KEY = "sk-168trRxnemem6nTpQn1rbmJ4SFKLwTMsZ0G6uk5OipP7FKAY" + GEMINI_FLASH_IMAGE_PREMIUM_KEY = "sk-OEbEnJORrKx4YEnLPEbwQL3eS5sp0eeSbtUepUrsIqjaLc1X" DICT_URL = "https://nas.4x4g.com:10011/api/common/sys/dict" PLATFORM = "lingmao" diff --git a/services/generation_service.py b/services/generation_service.py index 3aa73e4..40e181f 100644 --- a/services/generation_service.py +++ b/services/generation_service.py @@ -30,6 +30,10 @@ def validate_generation_request(user, data): is_premium = data.get('is_premium', False) input_key = data.get('apiKey') model_value = data.get('model') + is_gemini_flash_image_preview = model_value == 'gemini-3.1-flash-image-preview' + + if isinstance(is_premium, str): + is_premium = is_premium.lower() in ('1', 'true', 'yes', 'on') target_api = Config.AI_API api_key = None @@ -46,7 +50,12 @@ def validate_generation_request(user, data): db.session.commit() else: if user.points > 0: - api_key = Config.PREMIUM_KEY if is_premium else Config.TRIAL_KEY + if is_premium: + api_key = Config.GEMINI_FLASH_IMAGE_PREMIUM_KEY if is_gemini_flash_image_preview else Config.PREMIUM_KEY + elif is_gemini_flash_image_preview: + api_key = Config.PREMIUM_KEY + else: + api_key = Config.TRIAL_KEY target_api = Config.TRIAL_API use_trial = True else: diff --git a/templates/mobile.html b/templates/mobile.html index 071a6a4..17b81ab 100644 --- a/templates/mobile.html +++ b/templates/mobile.html @@ -442,6 +442,7 @@ // 初始化尺寸选择器显示状态 updateSizeVisibility(); + updateCostPreview(); } catch (e) { console.error('加载配置失败', e); } @@ -857,4 +858,4 @@ - \ No newline at end of file +