+
+
+ opencodeForm.setOpencodeProviderKey(
+ e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, ""),
+ )
+ }
+ placeholder={t("opencode.providerKeyPlaceholder")}
+ disabled={
+ isProviderKeyLocked || isProviderKeyLockStateLoading
+ }
+ className={
+ (additiveExistingProviderKeys.includes(
+ opencodeForm.opencodeProviderKey,
+ ) &&
+ !isProviderKeyLocked) ||
+ (opencodeForm.opencodeProviderKey.trim() !== "" &&
+ !/^[a-z0-9]+(-[a-z0-9]+)*$/.test(
+ opencodeForm.opencodeProviderKey,
+ ))
+ ? "border-destructive"
+ : ""
+ }
+ />
+ {additiveExistingProviderKeys.includes(
+ opencodeForm.opencodeProviderKey,
+ ) &&
+ !isProviderKeyLocked && (
+
+ {t("opencode.providerKeyDuplicate")}
+
+ )}
+ {opencodeForm.opencodeProviderKey.trim() !== "" &&
+ !/^[a-z0-9]+(-[a-z0-9]+)*$/.test(
+ opencodeForm.opencodeProviderKey,
+ ) && (
+
+ {t("opencode.providerKeyInvalid")}
+
+ )}
+ {!(
+ additiveExistingProviderKeys.includes(
+ opencodeForm.opencodeProviderKey,
+ ) && !isProviderKeyLocked
+ ) &&
+ (opencodeForm.opencodeProviderKey.trim() === "" ||
+ /^[a-z0-9]+(-[a-z0-9]+)*$/.test(
+ opencodeForm.opencodeProviderKey,
+ )) && (
+
+ {isProviderKeyLocked
+ ? t("opencode.providerKeyLockedHint", {
+ defaultValue:
+ "该供应商已添加到应用配置中,供应商标识不可修改",
+ })
+ : t("opencode.providerKeyHint")}
+
+ )}
+
+ ) : appId === "openclaw" ? (
+
+
+
+ openclawForm.setOpenclawProviderKey(
+ e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, ""),
+ )
+ }
+ placeholder={t("openclaw.providerKeyPlaceholder")}
+ disabled={
+ isProviderKeyLocked || isProviderKeyLockStateLoading
+ }
+ className={
+ (additiveExistingProviderKeys.includes(
+ openclawForm.openclawProviderKey,
+ ) &&
+ !isProviderKeyLocked) ||
+ (openclawForm.openclawProviderKey.trim() !== "" &&
+ !/^[a-z0-9]+(-[a-z0-9]+)*$/.test(
+ openclawForm.openclawProviderKey,
+ ))
+ ? "border-destructive"
+ : ""
+ }
+ />
+ {additiveExistingProviderKeys.includes(
+ openclawForm.openclawProviderKey,
+ ) &&
+ !isProviderKeyLocked && (
+
+ {t("openclaw.providerKeyDuplicate")}
+
+ )}
+ {openclawForm.openclawProviderKey.trim() !== "" &&
+ !/^[a-z0-9]+(-[a-z0-9]+)*$/.test(
+ openclawForm.openclawProviderKey,
+ ) && (
+
+ {t("openclaw.providerKeyInvalid")}
+
+ )}
+ {!(
+ additiveExistingProviderKeys.includes(
+ openclawForm.openclawProviderKey,
+ ) && !isProviderKeyLocked
+ ) &&
+ (openclawForm.openclawProviderKey.trim() === "" ||
+ /^[a-z0-9]+(-[a-z0-9]+)*$/.test(
+ openclawForm.openclawProviderKey,
+ )) && (
+
+ {isProviderKeyLocked
+ ? t("openclaw.providerKeyLockedHint", {
+ defaultValue:
+ "该供应商已添加到应用配置中,供应商标识不可修改",
+ })
+ : t("openclaw.providerKeyHint")}
+
+ )}
+
+ ) : undefined
+ }
/>
- )}
- {/* 配置编辑器:Codex、Claude、Gemini 分别使用不同的编辑器 */}
- {appId === "codex" ? (
- <>
-
- {settingsConfigErrorField}
- >
- ) : appId === "gemini" ? (
- <>
-
- {settingsConfigErrorField}
- >
- ) : appId === "opencode" &&
- (category === "omo" || category === "omo-slim") ? (
-
-
- {}}
- rows={14}
- showValidation={false}
- language="json"
+ )}
+
+ {appId === "codex" && (
+
-
- ) : appId === "opencode" &&
- category !== "omo" &&
- category !== "omo-slim" ? (
- <>
+ )}
+
+ {appId === "gemini" && (
+
+ )}
+
+ {appId === "opencode" && !isAnyOmoCategory && (
+
+ )}
+
+ {appId === "opencode" &&
+ (category === "omo" || category === "omo-slim") && (
+
+ )}
+
+ {/* OpenClaw 专属字段 */}
+ {appId === "openclaw" && (
+
+ )}
+
+ {/* 配置编辑器:Codex、Claude、Gemini 分别使用不同的编辑器 */}
+ {appId === "codex" ? (
+ <>
+
+ {settingsConfigErrorField}
+ >
+ ) : appId === "gemini" ? (
+ <>
+
+ {settingsConfigErrorField}
+ >
+ ) : appId === "opencode" &&
+ (category === "omo" || category === "omo-slim") ? (
-
+
form.setValue("settingsConfig", config)}
- placeholder={`{
+ value={omoDraft.mergedOmoJsonPreview}
+ onChange={() => {}}
+ rows={14}
+ showValidation={false}
+ language="json"
+ />
+
+ ) : appId === "opencode" &&
+ category !== "omo" &&
+ category !== "omo-slim" ? (
+ <>
+
+
+ form.setValue("settingsConfig", config)}
+ placeholder={`{
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://your-api-endpoint.com",
@@ -1779,82 +1785,86 @@ export function ProviderForm({
},
"models": {}
}`}
- rows={14}
- showValidation={true}
- language="json"
- />
-
- {settingsConfigErrorField}
- >
- ) : appId === "openclaw" ? (
- <>
-
-
- form.setValue("settingsConfig", config)}
- placeholder={`{
+ rows={14}
+ showValidation={true}
+ language="json"
+ />
+
+ {settingsConfigErrorField}
+ >
+ ) : appId === "openclaw" ? (
+ <>
+
+
+ form.setValue("settingsConfig", config)}
+ placeholder={`{
"baseUrl": "https://api.example.com/v1",
"apiKey": "your-api-key-here",
"api": "openai-completions",
"models": []
}`}
- rows={14}
- showValidation={true}
- language="json"
+ rows={14}
+ showValidation={true}
+ language="json"
+ />
+
+ (
+
+
+
+ )}
/>
+ >
+ ) : (
+ <>
+ form.setValue("settingsConfig", value)}
+ useCommonConfig={useCommonConfig}
+ onCommonConfigToggle={handleCommonConfigToggle}
+ commonConfigSnippet={commonConfigSnippet}
+ onCommonConfigSnippetChange={handleCommonConfigSnippetChange}
+ commonConfigError={commonConfigError}
+ onEditClick={() => setIsCommonConfigModalOpen(true)}
+ isModalOpen={isCommonConfigModalOpen}
+ onModalClose={() => setIsCommonConfigModalOpen(false)}
+ onExtract={handleClaudeExtract}
+ isExtracting={isClaudeExtracting}
+ />
+ {settingsConfigErrorField}
+ >
+ )}
+
+ {!isAnyOmoCategory &&
+ appId !== "opencode" &&
+ appId !== "openclaw" && (
+
+ )}
+
+ {showButtons && (
+
+
+
- (
-
-
-
- )}
- />
- >
- ) : (
- <>
- form.setValue("settingsConfig", value)}
- useCommonConfig={useCommonConfig}
- onCommonConfigToggle={handleCommonConfigToggle}
- commonConfigSnippet={commonConfigSnippet}
- onCommonConfigSnippetChange={handleCommonConfigSnippetChange}
- commonConfigError={commonConfigError}
- onEditClick={() => setIsCommonConfigModalOpen(true)}
- isModalOpen={isCommonConfigModalOpen}
- onModalClose={() => setIsCommonConfigModalOpen(false)}
- onExtract={handleClaudeExtract}
- isExtracting={isClaudeExtracting}
- />
- {settingsConfigErrorField}
- >
- )}
-
- {!isAnyOmoCategory && appId !== "opencode" && appId !== "openclaw" && (
-
- )}
-
- {showButtons && (
-
-
-
-
- )}
+ )}