fix(ui-models): restore the add-provider row and hint an empty capacity
The two ways to gain a provider had picked up the shared button base's pill shape and shrunk to their labels, so they read as two stray buttons of different lengths under the list instead of its last slot. They split the row evenly again, on the row cards' own corner and the dashed outline this page already uses for "nothing here yet"; the rule that overrides the base now says so in one place rather than layering a second `.addButton` block. An empty capacity shows the adapter's route-level fallback as its placeholder, so a blank field reads as "sized by the route" rather than as a model with no capacity. It is a hint, not a mirror: the field counts K as 1000 while the fallback is 262144, and a deployment may override it. The picker's description says what the list is without promising an edit the rows themselves already offer.
This commit is contained in:
@@ -109,6 +109,22 @@ function IconTrash(): ReactNode {
|
||||
/** The two token counts edited as K/M-suffixed text behind a row's disclosure. */
|
||||
type CapacityField = 'contextWindow' | 'maxTokens'
|
||||
|
||||
/**
|
||||
* What an empty capacity field is worth, shown as its placeholder so a row left
|
||||
* blank does not read as a model with no capacity at all.
|
||||
*
|
||||
* The magnitudes are the adapter's own route-level fallbacks (`llm-pi-ai`'s
|
||||
* `defaultContextWindow` and `defaultMaxTokens`), spelled the way a person
|
||||
* would say them. They are a hint, not a mirror: this page counts `K` as 1000,
|
||||
* so typing `256K` stores 256000 while leaving the field blank keeps the
|
||||
* adapter's 262144. A deployment that overrides those defaults is not
|
||||
* reflected here — nothing on this page can read them.
|
||||
*/
|
||||
const CAPACITY_HINT: Readonly<Record<CapacityField, string>> = {
|
||||
contextWindow: '256K',
|
||||
maxTokens: '32K',
|
||||
}
|
||||
|
||||
/**
|
||||
* Spell a stored count for a field that may be unset. The spelling itself is
|
||||
* {@link formatCapacity}, shared with the DeepSeek catalog editor so both
|
||||
@@ -373,6 +389,7 @@ export function ModelListEditor(props: ModelListEditorProps): ReactNode {
|
||||
type="text"
|
||||
inputMode="numeric"
|
||||
value={capacityText(index, 'contextWindow')}
|
||||
placeholder={CAPACITY_HINT.contextWindow}
|
||||
aria-label={`${t('modelContextWindow')} ${index + 1}`}
|
||||
disabled={disabled}
|
||||
onChange={(event) => { editCapacity(index, 'contextWindow', event.target.value) }}
|
||||
@@ -385,6 +402,7 @@ export function ModelListEditor(props: ModelListEditorProps): ReactNode {
|
||||
type="text"
|
||||
inputMode="numeric"
|
||||
value={capacityText(index, 'maxTokens')}
|
||||
placeholder={CAPACITY_HINT.maxTokens}
|
||||
aria-label={`${t('modelMaxTokens')} ${index + 1}`}
|
||||
disabled={disabled}
|
||||
onChange={(event) => { editCapacity(index, 'maxTokens', event.target.value) }}
|
||||
|
||||
@@ -273,14 +273,17 @@
|
||||
}
|
||||
|
||||
.addButton {
|
||||
/* Master's pill shape and glyph gap, sized to share the row equally so the
|
||||
two ways to gain a provider read as siblings and line up with the rows
|
||||
above rather than as two pills of different lengths. */
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
/* Overrides the shared button base above: these two are not pills sitting in
|
||||
a footer but the last slot of the provider list, so they split the row
|
||||
evenly and repeat the row cards' corner. Dashed, like every other "nothing
|
||||
here yet" affordance on this page, to read as a place rather than a
|
||||
command. */
|
||||
flex: 1 1 0;
|
||||
min-width: 180px;
|
||||
gap: 6px;
|
||||
align-self: flex-start;
|
||||
height: 44px;
|
||||
border: 1px dashed var(--dsw-alias-border-l3);
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.addCard,
|
||||
|
||||
@@ -61,7 +61,7 @@ export const en = {
|
||||
fetchNeedsBaseUrl: 'Enter the base URL first, then fetch.',
|
||||
fetchEmpty: 'The provider listed no models. Add them by hand.',
|
||||
fetchTitle: 'Choose models to add',
|
||||
fetchDescription: 'These are the models the provider reports. Choose the ones to add; you can still edit their capacities afterwards.',
|
||||
fetchDescription: 'These are the models this provider has available. Choose the ones to add.',
|
||||
fetchAdopt: 'Add selected',
|
||||
customAdd: 'Add a custom provider',
|
||||
customTitle: 'Custom provider',
|
||||
@@ -145,7 +145,7 @@ export const zh: typeof en = {
|
||||
fetchNeedsBaseUrl: '请先填写 API 地址,再获取。',
|
||||
fetchEmpty: '该提供方没有列出任何模型,请手动添加。',
|
||||
fetchTitle: '选择要添加的模型',
|
||||
fetchDescription: '以下是提供方报告的模型。勾选要添加的项,添加后仍可修改其容量。',
|
||||
fetchDescription: '以下是模型提供方的可用模型,勾选要添加的模型。',
|
||||
fetchAdopt: '添加所选',
|
||||
customAdd: '添加自定义提供方',
|
||||
customTitle: '自定义提供方',
|
||||
|
||||
Reference in New Issue
Block a user