feat(settings): clarify custom gateway format

This commit is contained in:
chengma
2026-07-21 09:49:22 +08:00
parent 3cd71b5285
commit 5b57a6c769
4 changed files with 35 additions and 5 deletions
+17 -2
View File
@@ -67,7 +67,10 @@ class SettingsTab(QWidget):
settingsSaved = Signal(str)
BACKEND_ITEMS = [("默认网关", "cmhub"), ("自定义网关", "direct")]
BACKEND_ITEMS = [
("默认网关", "cmhub"),
("自定义网关(仅支持 OpenAI 格式)", "direct"),
]
CATEGORY_ITEMS = [("文本", "text"), ("图像", "image")]
API_TYPE_ITEMS = [("chat", "chat"), ("images_edits", "images_edits"), ("auto", "auto")]
IMAGE_API_TYPE_ITEMS = [("OpenAI 图片编辑接口", "images_edits")]
@@ -118,8 +121,11 @@ class SettingsTab(QWidget):
self.backend_combo.setVisible(False)
self.gateway_default_button = QRadioButton("默认网关")
self.gateway_default_button.setObjectName("gatewayDefaultButton")
self.gateway_custom_button = QRadioButton("自定义网关")
self.gateway_custom_button = QRadioButton("自定义网关(仅支持 OpenAI 格式)")
self.gateway_custom_button.setObjectName("gatewayCustomButton")
self.gateway_custom_button.setToolTip(
"仅支持 OpenAI 格式的文本接口和图片编辑接口。"
)
self.gateway_button_group = QButtonGroup(self)
self.gateway_button_group.setExclusive(True)
self.gateway_button_group.addButton(self.gateway_default_button)
@@ -138,6 +144,13 @@ class SettingsTab(QWidget):
"QRadioButton:focus { border: 1px solid #0969da; border-radius: 4px; }"
"QRadioButton::indicator { width: 15px; height: 15px; }"
)
self.custom_gateway_hint_label = QLabel(
"只有服务商明确说明“支持 OpenAI 格式接口”时才选择此项。"
)
self.custom_gateway_hint_label.setObjectName("customGatewayFormatHintLabel")
self.custom_gateway_hint_label.setStyleSheet("color: #57606a; padding: 0 12px;")
self.custom_gateway_hint_label.setWordWrap(True)
self.custom_gateway_hint_label.setVisible(False)
self.cmhub_base_url_edit = QLineEdit()
self.cmhub_base_url_edit.setObjectName("cmhubBaseUrlEdit")
self.cmhub_base_url_edit.setPlaceholderText("https://host(不要带 /api 或 /api/v1)")
@@ -419,6 +432,7 @@ class SettingsTab(QWidget):
)
panel_layout.addWidget(self.ai_model_section_title)
panel_layout.addWidget(self.gateway_selector)
panel_layout.addWidget(self.custom_gateway_hint_label)
panel_layout.addSpacing(8)
panel_layout.addWidget(self.model_picker_panel)
panel_layout.addSpacing(8)
@@ -674,6 +688,7 @@ class SettingsTab(QWidget):
self.backend_combo.blockSignals(previous)
self.backend_combo.setVisible(False)
is_direct = backend == "direct"
self.custom_gateway_hint_label.setVisible(is_direct)
self.model_picker_panel.setVisible(is_direct)
self.model_detail_panel.setVisible(is_direct)
self.direct_role_panel.setVisible(is_direct)