feat: 完整游戏运维功能
This commit is contained in:
@@ -118,6 +118,8 @@ export function AiProvidersPage({ initialState }: AiProvidersPageProps = {}) {
|
||||
const key = event.target.name as keyof AiProviderFormState;
|
||||
if (key === "kind") {
|
||||
setForm((current) => applyAiProviderKindDefaults(current, event.target.value as AiProviderKind));
|
||||
} else if (key === "apiKeyRef") {
|
||||
setForm((current) => ({ ...current, apiKeyRef: event.target.value, apiKeyConfigured: current.apiKeyConfigured || Boolean(event.target.value.trim()) }));
|
||||
} else {
|
||||
updateForm(key, event.target.value);
|
||||
}
|
||||
@@ -166,7 +168,7 @@ export function AiProvidersPage({ initialState }: AiProvidersPageProps = {}) {
|
||||
if (!completed.baseUrl.trim()) {
|
||||
missing.push("Base URL");
|
||||
}
|
||||
if (completed.relayMode !== "local" && !completed.apiKeyRef.trim().startsWith("secret://providers/")) {
|
||||
if (completed.relayMode !== "local" && !completed.apiKeyConfigured && !completed.apiKeyRef.trim().startsWith("secret://providers/")) {
|
||||
missing.push("secret://providers/... 密钥引用");
|
||||
}
|
||||
if (models.length === 0) {
|
||||
@@ -365,7 +367,7 @@ export function AiProvidersPage({ initialState }: AiProvidersPageProps = {}) {
|
||||
<th>类型</th>
|
||||
<th>模式</th>
|
||||
<th>模型</th>
|
||||
<th>密钥引用</th>
|
||||
<th>密钥状态</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -385,7 +387,7 @@ export function AiProvidersPage({ initialState }: AiProvidersPageProps = {}) {
|
||||
<td>{provider.relayMode}</td>
|
||||
<td>{provider.models.length}</td>
|
||||
<td>
|
||||
<code className="secret-ref">{provider.apiKeyRef}</code>
|
||||
<span className={cx("status-pill", provider.apiKeyConfigured ? "status-active" : "status-disabled")}>{provider.apiKeyConfigured ? "已配置" : "未配置"}</span>
|
||||
</td>
|
||||
<td className="provider-actions-cell">
|
||||
<div className="row-actions human-row-actions" aria-label={`${provider.name} 操作`}>
|
||||
@@ -459,7 +461,7 @@ export function AiProvidersPage({ initialState }: AiProvidersPageProps = {}) {
|
||||
</label>
|
||||
<label>
|
||||
<span>{secretRequired ? "平台密钥引用" : "密钥引用(本地模式可留空)"}</span>
|
||||
<input name="apiKeyRef" value={form.apiKeyRef} onChange={handleInput} placeholder={secretRequired ? formDefaults.apiKeyRef : "本地服务通常不需要"} />
|
||||
<input name="apiKeyRef" value={form.apiKeyRef} onChange={handleInput} placeholder={form.apiKeyConfigured ? "已配置;留空保持不变" : secretRequired ? "secret://providers/..." : "本地服务通常不需要"} />
|
||||
<small className="field-help">
|
||||
{secretRequired ? "填写 secret://providers/...;真实密钥进入平台 secret store,不粘贴到页面。" : "Ollama 本地模式默认只需要 Base URL 和模型名。"}
|
||||
</small>
|
||||
|
||||
Reference in New Issue
Block a user