This commit is contained in:
@@ -38,9 +38,28 @@ interface GatewayBackend {
|
||||
endpoint?: string;
|
||||
model?: string;
|
||||
maxSlots?: number;
|
||||
/** Performance tiers (Roles) this backend serves. Empty = serves all. */
|
||||
roles?: string[];
|
||||
apiKey?: string;
|
||||
}
|
||||
|
||||
/** Format a roles array for the comma-separated text input. */
|
||||
function rolesToInput(roles: string[] | undefined): string {
|
||||
return Array.isArray(roles) ? roles.join(', ') : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the comma-separated roles input into a deduped string array, or
|
||||
* `undefined` when blank (= backend serves every role, migration-safe).
|
||||
*/
|
||||
function parseRolesInput(v: string): string[] | undefined {
|
||||
const parts = v
|
||||
.split(',')
|
||||
.map(s => s.trim())
|
||||
.filter(s => s.length > 0);
|
||||
return parts.length > 0 ? [...new Set(parts)] : undefined;
|
||||
}
|
||||
|
||||
interface GatewayConfigShape {
|
||||
enabled?: boolean;
|
||||
listenPort?: number;
|
||||
@@ -246,7 +265,7 @@ export function GatewayServerForm({ config, onChange }: SectionFormProps) {
|
||||
</button>
|
||||
</div>
|
||||
<HelpText>
|
||||
ルーティング先の llama-server / Ollama / vLLM など。Gateway は <code>request.model</code> に一致する <code>model</code> を持つ最も busy ではない backend に割り振ります。<br/>
|
||||
ルーティング先の llama-server / Ollama / vLLM など。Gateway は worker が送る <strong>role</strong> を担う backend のうち最も空いているものに割り振ります (<code>roles</code> 未設定の backend は全 role 対応)。role を担う backend が無い場合のみ <code>request.model</code> = <code>id</code>/<code>model</code> の厳密一致にフォールバックします。<br/>
|
||||
<strong>api_key の保存形式</strong>: フォームで入力した値は <code>config.yaml</code> に平文で保存されます。<code>${'${VAR}'}</code> 形式の env var 参照はフォーム保存時に literal 文字列として保存されるため、env 経由で渡したい場合は <code>config.yaml</code> を直接編集してください。
|
||||
</HelpText>
|
||||
{backends.length === 0 ? (
|
||||
@@ -291,6 +310,17 @@ export function GatewayServerForm({ config, onChange }: SectionFormProps) {
|
||||
placeholder="1"
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<FieldLabel>roles (任意)</FieldLabel>
|
||||
<FieldInput
|
||||
value={rolesToInput(b.roles)}
|
||||
onChange={v => updateBackend(i, 'roles', parseRolesInput(v))}
|
||||
placeholder="quality, auto (空欄=全ロール)"
|
||||
/>
|
||||
<HelpText>
|
||||
この backend が担う性能ティア (<code>auto</code> / <code>fast</code> / <code>quality</code> / <code>reflection</code>) をカンマ区切りで。worker はジョブの role を routing key として送り、Gateway がその role を担う最も空いている backend に振ります。<strong>空欄なら全ロール</strong>を担当 (従来どおり)。異なる model 名の GPU でも同じ role でまとめられます。
|
||||
</HelpText>
|
||||
</div>
|
||||
<div>
|
||||
<FieldLabel>api_key (任意)</FieldLabel>
|
||||
<FieldInput
|
||||
|
||||
Reference in New Issue
Block a user