rerere
This commit is contained in:
+7
-7
@@ -6748,9 +6748,9 @@ async def configai_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
async def configai_callback(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
"""Inline-button state machine for AI provider/model selection.
|
||||
|
||||
configia_provider_*: stores the provider, writes AI_PROVIDER to
|
||||
configai_provider_*: stores the provider, writes AI_PROVIDER to
|
||||
.env, and shows that provider's model buttons.
|
||||
configia_model_*: writes DEFAULT_MODEL to .env (or switches to a
|
||||
configai_model_*: writes DEFAULT_MODEL to .env (or switches to a
|
||||
free-text step for "custom..."), updates the in-process globals,
|
||||
reloads .env, and finishes the wizard.
|
||||
|
||||
@@ -6769,23 +6769,23 @@ async def configai_callback(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
global IA_CONFIG_STEPS, IA_CONFIG_ANSWERS, is_configai
|
||||
if not is_configai:
|
||||
return
|
||||
if data.startswith("configia_provider_"):
|
||||
provider = data.replace("configia_provider_", "").strip()
|
||||
if data.startswith("configai_provider_"):
|
||||
provider = data.replace("configai_provider_", "").strip()
|
||||
if provider not in {p for p, _ in CONFIGIA_PROVIDERS}:
|
||||
return
|
||||
IA_CONFIG_ANSWERS["provider"] = provider
|
||||
_update_env_var("AI_PROVIDER", provider)
|
||||
models = CONFIGIA_MODELS.get(provider, ["custom..."])
|
||||
keyboard = InlineKeyboardMarkup(
|
||||
[[InlineKeyboardButton(model, callback_data=f"configia_model_{model}")] for model in models]
|
||||
[[InlineKeyboardButton(model, callback_data=f"configai_model_{model}")] for model in models]
|
||||
)
|
||||
await query.edit_message_text(
|
||||
f"Provider selected: {provider}\n\nSelect the model:",
|
||||
reply_markup=keyboard,
|
||||
)
|
||||
return
|
||||
if data.startswith("configia_model_"):
|
||||
raw_model = data.replace("configia_model_", "").strip()
|
||||
if data.startswith("configai_model_"):
|
||||
raw_model = data.replace("configai_model_", "").strip()
|
||||
if raw_model == "custom...":
|
||||
await query.edit_message_text("Send the model identifier you want to use.")
|
||||
IA_CONFIG_STEPS = ["custom_model"]
|
||||
|
||||
Reference in New Issue
Block a user