dsh-model-extension 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/lib/client.js +450 -203
- package/lib/client.js.map +1 -1
- package/package.json +15 -10
package/lib/client.js
CHANGED
|
@@ -3,7 +3,7 @@ window.__ModuleLoader__.load({
|
|
|
3
3
|
factory: (require) => {
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
|
-
var __extCss = "._5ikCMa_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}._5ikCMa_titleRow{align-items:center;gap:10px;display:flex}._5ikCMa_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}._5ikCMa_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}._5ikCMa_savedNotice{color:var(--dsw-alias-state-success-primary);margin:0;font-size:12px;line-height:18px}._5ikCMa_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}._5ikCMa_rows{flex-direction:column;gap:8px;margin:12px 0 0;padding:0;list-style:none;display:flex}._5ikCMa_rowCard{border:.5px solid var(--dsw-alias-border-l4);border-radius:16px;flex-direction:column;gap:12px;padding:12px 14px;display:flex}._5ikCMa_rowHead{align-items:center;gap:10px;display:flex}._5ikCMa_rowIdentity{align-items:center;gap:6px;min-width:0;display:inline-flex}._5ikCMa_rowName{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}._5ikCMa_rowTag{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary);border-radius:4px;flex:none;padding:1px 6px;font-size:11px;line-height:16px}._5ikCMa_credentialDot{box-sizing:border-box;border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}._5ikCMa_credentialDotConfigured{background:var(--dsw-alias-state-success-primary)}._5ikCMa_credentialDotMissing{background:var(--dsw-alias-state-error-primary)}._5ikCMa_rowActions{align-items:center;gap:4px;margin-left:auto;display:inline-flex}._5ikCMa_primaryButton,._5ikCMa_secondaryButton,._5ikCMa_addButton{box-sizing:border-box;height:36px;font:inherit;cursor:pointer;border:none;border-radius:18px;justify-content:center;align-items:center;gap:4px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}._5ikCMa_primaryButton{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}._5ikCMa_primaryButton:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}._5ikCMa_secondaryButton,._5ikCMa_addButton{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary);background:0 0}._5ikCMa_secondaryButton:hover:not(:disabled),._5ikCMa_addButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._5ikCMa_secondaryButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}._5ikCMa_dangerButton{box-sizing:border-box;height:36px;color:var(--dsw-alias-state-error-primary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:18px;justify-content:center;align-items:center;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}._5ikCMa_dangerButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}._5ikCMa_rowActions ._5ikCMa_secondaryButton,._5ikCMa_rowActions ._5ikCMa_dangerButton{border-radius:14px;height:28px;padding:0 10px;font-size:12px;line-height:18px}._5ikCMa_primaryButton:disabled,._5ikCMa_secondaryButton:disabled,._5ikCMa_dangerButton:disabled,._5ikCMa_addButton:disabled,._5ikCMa_linkButton:disabled,._5ikCMa_addModelButton:disabled{opacity:.4;cursor:default}._5ikCMa_primaryButton:focus-visible,._5ikCMa_secondaryButton:focus-visible,._5ikCMa_dangerButton:focus-visible,._5ikCMa_addButton:focus-visible,._5ikCMa_linkButton:focus-visible,._5ikCMa_addModelButton:focus-visible,._5ikCMa_iconButton:focus-visible,._5ikCMa_dragHandle:focus-visible,._5ikCMa_customizedSummary:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-border-l3);outline:none}._5ikCMa_editor{background:var(--dsw-alias-bg-module-platform);border-radius:12px;flex-direction:column;gap:14px;padding:14px 16px;display:flex}._5ikCMa_field{flex-direction:column;gap:6px;display:flex}._5ikCMa_fieldLabel{color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:12px;font-weight:500;line-height:18px;display:inline-flex}._5ikCMa_linkButton{box-sizing:border-box;height:28px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:14px;align-items:center;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}._5ikCMa_linkButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}._5ikCMa_advancedHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}._5ikCMa_editorActions{justify-content:flex-end;gap:8px;display:flex}._5ikCMa_addBlock{flex-direction:column;gap:12px;display:flex}._5ikCMa_addActions{flex-wrap:wrap;gap:10px;display:flex}._5ikCMa_addButton{border:1px dashed var(--dsw-alias-border-l3);border-radius:16px;flex:1 1 0;gap:6px;min-width:180px;height:44px}._5ikCMa_addCard{background:var(--dsw-alias-bg-module-platform);border-radius:12px;flex-direction:column;gap:14px;padding:14px 16px;list-style:none;display:flex}._5ikCMa_addCard ._5ikCMa_editor,._5ikCMa_setupCard ._5ikCMa_editor{background:0 0;padding:0}._5ikCMa_tabs{flex-direction:column;gap:12px;display:flex}._5ikCMa_tabBar{border-bottom:.5px solid var(--dsw-alias-border-l2);gap:4px;display:flex}._5ikCMa_tabButton{appearance:none;font:inherit;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:6px 12px 8px;font-size:13px;line-height:20px;position:relative}._5ikCMa_tabButton:hover{color:var(--dsw-alias-label-primary)}._5ikCMa_tabButton:disabled{opacity:.4;cursor:default}._5ikCMa_tabButtonActive{color:var(--dsw-alias-label-primary);font-weight:500}._5ikCMa_tabButtonActive:after{content:\"\";background:var(--dsw-alias-brand-primary);border-radius:2px;height:2px;position:absolute;bottom:-1px;left:10px;right:10px}._5ikCMa_tabPanel{flex-direction:column;gap:12px;display:flex}._5ikCMa_modelCatalog{flex-direction:column;gap:10px;display:flex}._5ikCMa_modelCatalogHeading{flex-direction:column;gap:2px;display:flex}._5ikCMa_modelCatalogTitle{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px}._5ikCMa_modelCatalogMeta,._5ikCMa_modelEmpty{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}._5ikCMa_modelList{flex-direction:column;gap:8px;display:flex}._5ikCMa_modelListHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}._5ikCMa_modelEntry{border:.5px solid var(--dsw-alias-border-l4);border-radius:10px;padding:6px}._5ikCMa_modelRow{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) auto auto auto;align-items:center;gap:6px;display:grid;position:relative}._5ikCMa_modelEntryDragging{border:.5px solid var(--dsw-alias-border-l4);opacity:.5;border-radius:10px;padding:6px}._5ikCMa_dragHandle{box-sizing:border-box;width:24px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:grab;touch-action:none;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;display:inline-flex}._5ikCMa_dragHandle:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}._5ikCMa_dragHandle:active:not(:disabled){cursor:grabbing}._5ikCMa_dragHandle:disabled{cursor:default;opacity:.4}._5ikCMa_modelDropLine{background:var(--dsw-alias-brand-primary);pointer-events:none;border-radius:2px;height:2px;position:absolute;left:0;right:0}._5ikCMa_modelDropLine[data-edge=before]{top:-5px}._5ikCMa_modelDropLine[data-edge=after]{bottom:-5px}._5ikCMa_iconButton{box-sizing:border-box;width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;display:inline-flex}._5ikCMa_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}._5ikCMa_iconButton:disabled{cursor:default;opacity:.4}._5ikCMa_iconButtonDanger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary)}._5ikCMa_modelAdvanced{grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:8px;padding:8px 4px 2px;display:grid}._5ikCMa_modelField{flex-direction:column;gap:4px;display:flex}._5ikCMa_modelFieldLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._5ikCMa_modelEmpty{border:1px dashed var(--dsw-alias-border-l3);text-align:center;border-radius:8px;padding:12px}._5ikCMa_addModelButton{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border-radius:14px;align-self:flex-start;align-items:center;gap:4px;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}._5ikCMa_addModelButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._5ikCMa_input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);width:100%;height:32px;font:inherit;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 10px;font-size:14px;line-height:22px}select._5ikCMa_input{cursor:pointer;max-width:240px}._5ikCMa_input:focus{border-color:var(--dsw-alias-brand-primary);outline:none}._5ikCMa_input::placeholder{color:var(--dsw-alias-label-dimmed)}._5ikCMa_input:disabled{opacity:.6;cursor:default}._5ikCMa_selectInput{appearance:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");background-position:right 12px center;background-repeat:no-repeat;background-size:12px 12px;padding-right:32px}._5ikCMa_deleteDialog{width:min(480px,100%)}._5ikCMa_deleteConfirm:not(:disabled){border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}._5ikCMa_deleteConfirm:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}._5ikCMa_fetchDialog{max-width:520px}._5ikCMa_candidateToolbar{align-items:center;gap:8px;margin-bottom:6px;display:flex}._5ikCMa_candidateSearch{flex:240px;min-width:0}._5ikCMa_candidateList{flex-direction:column;gap:2px;max-height:320px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}._5ikCMa_candidate{border-radius:6px}._5ikCMa_candidateLabel{cursor:pointer;align-items:center;gap:8px;padding:6px 8px;display:flex}._5ikCMa_candidateId{overflow-wrap:anywhere;flex:auto;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px}._5ikCMa_candidateEmpty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0;font-size:13px;line-height:20px}[hidden]{display:none!important}._5ikCMa_extBlock{border:.5px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-layer-1);border-radius:10px;flex-direction:column;gap:10px;margin:8px 4px 2px;padding:10px;display:flex}._5ikCMa_extGroup{border-top:.5px solid var(--dsw-alias-border-l2);padding-top:12px}._5ikCMa_extGroupFirst{border-top:none;padding-top:0}._5ikCMa_extCheck{cursor:pointer;align-items:flex-start;gap:8px;display:flex}._5ikCMa_extCheckLabel{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}._5ikCMa_extHint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._5ikCMa_extGated{flex-direction:column;gap:12px;padding-left:2px;display:flex}._5ikCMa_extField{flex-direction:column;gap:6px;display:flex}._5ikCMa_extLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._5ikCMa_extTable{border:.5px solid var(--dsw-alias-border-l4);border-radius:8px;overflow:hidden}._5ikCMa_extTHead{color:var(--dsw-alias-label-tertiary);background:var(--dsw-alias-bg-module-platform);grid-template-columns:64px minmax(0,1fr) minmax(0,1.2fr);font-size:12px;line-height:18px;display:grid}._5ikCMa_extTHead>div{padding:6px 10px}._5ikCMa_extTHead>div+div{border-left:.5px solid var(--dsw-alias-border-l2)}._5ikCMa_extTRow{border-top:.5px solid var(--dsw-alias-border-l2);grid-template-columns:64px minmax(0,1fr) minmax(0,1.2fr);align-items:center;display:grid}._5ikCMa_extTRow>div{padding:6px 10px;font-size:14px}._5ikCMa_extTRow>div+div{border-left:.5px solid var(--dsw-alias-border-l2)}._5ikCMa_extTRow input[type=text]{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);width:100%;height:32px;font:inherit;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 10px;font-size:14px}._5ikCMa_extTRow input[type=text]:disabled{opacity:.6;cursor:default}._5ikCMa_extCheckbox{accent-color:var(--dsw-alias-brand-primary);flex:none;width:15px;height:15px}._5ikCMa_switchRow{cursor:pointer;align-items:center;gap:8px;font-size:14px;line-height:22px;display:flex}._5ikCMa_extTag{background:var(--dsw-static-deepseek-100);color:var(--dsw-static-deepseek-600);border:.5px solid #4176e659;border-radius:4px;flex:none;padding:1px 6px;font-size:11px;font-weight:500;line-height:16px}._5ikCMa_modalMask{background:var(--dsw-alias-bg-mask-1);z-index:100;justify-content:center;align-items:center;padding:24px;display:flex;position:fixed;inset:0}._5ikCMa_modal{background:var(--dsw-specific-menu);border-radius:16px;width:100%;padding:20px;box-shadow:0 12px 40px #0000002e}._5ikCMa_modalTitle{color:var(--dsw-alias-label-primary);margin-bottom:8px;font-size:16px;font-weight:500;line-height:24px}._5ikCMa_modalDesc{color:var(--dsw-alias-label-secondary);margin-bottom:16px;font-size:14px;line-height:22px}._5ikCMa_modalFoot{justify-content:flex-end;gap:8px;display:flex}._5ikCMa_quickWrap{flex-direction:column;gap:6px;display:flex;position:relative}._5ikCMa_quickList{z-index:20;background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);border:0;border-radius:8px;max-height:264px;margin-top:2px;padding:4px;position:absolute;top:100%;left:0;right:0;overflow-y:auto}._5ikCMa_quickItem{width:100%;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;flex-direction:column;gap:1px;padding:6px 8px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;display:flex}._5ikCMa_quickItemId{overflow-wrap:anywhere}._5ikCMa_quickItemApi{color:var(--dsw-alias-label-tertiary);letter-spacing:.2px;font-size:11px;line-height:14px}._5ikCMa_quickItem:hover{background:var(--dsw-alias-interactive-bg-hover)}._5ikCMa_quickEmpty{color:var(--dsw-alias-label-tertiary);padding:6px 8px;font-size:12px;line-height:18px}@media (prefers-reduced-motion:reduce){._5ikCMa_customizedSummary:before{transition:none}}\n";
|
|
6
|
+
var __extCss = "._5ikCMa_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}._5ikCMa_titleRow{align-items:center;gap:10px;display:flex}._5ikCMa_title{color:var(--dsw-alias-label-primary);margin:0;font-size:16px;font-weight:500;line-height:24px}._5ikCMa_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}._5ikCMa_savedNotice{color:var(--dsw-alias-state-success-primary);margin:0;font-size:12px;line-height:18px}._5ikCMa_notice{color:var(--dsw-alias-state-warn-label);margin:0;font-size:12px;line-height:18px}._5ikCMa_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}._5ikCMa_rows{flex-direction:column;gap:8px;margin:12px 0 0;padding:0;list-style:none;display:flex}._5ikCMa_rowCard{border:.5px solid var(--dsw-alias-border-l4);border-radius:16px;flex-direction:column;gap:12px;padding:12px 14px;display:flex}._5ikCMa_rowHead{align-items:center;gap:10px;display:flex}._5ikCMa_rowIdentity{align-items:center;gap:6px;min-width:0;display:inline-flex}._5ikCMa_rowName{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:22px}._5ikCMa_rowTag{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-secondary);border-radius:4px;flex:none;padding:1px 6px;font-size:11px;line-height:16px}._5ikCMa_credentialDot{box-sizing:border-box;border-radius:50%;flex:none;width:8px;height:8px;display:inline-block}._5ikCMa_credentialDotConfigured{background:var(--dsw-alias-state-success-primary)}._5ikCMa_accountStatus{color:var(--dsw-alias-state-success-primary);align-items:center;gap:4px;font-size:12px;line-height:18px;display:inline-flex}._5ikCMa_credentialDotMissing{background:var(--dsw-alias-state-error-primary)}._5ikCMa_rowActions{align-items:center;gap:4px;margin-left:auto;display:inline-flex}._5ikCMa_primaryButton,._5ikCMa_secondaryButton,._5ikCMa_addButton{box-sizing:border-box;height:36px;font:inherit;cursor:pointer;border:none;border-radius:18px;justify-content:center;align-items:center;gap:4px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}._5ikCMa_primaryButton{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}._5ikCMa_primaryButton:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}._5ikCMa_secondaryButton,._5ikCMa_addButton{border:.5px solid var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary);background:0 0}._5ikCMa_secondaryButton:hover:not(:disabled),._5ikCMa_addButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._5ikCMa_secondaryButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}._5ikCMa_dangerButton{box-sizing:border-box;height:36px;color:var(--dsw-alias-state-error-primary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:18px;justify-content:center;align-items:center;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}._5ikCMa_dangerButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}._5ikCMa_rowActions ._5ikCMa_secondaryButton,._5ikCMa_rowActions ._5ikCMa_dangerButton{border-radius:14px;height:28px;padding:0 10px;font-size:12px;line-height:18px}._5ikCMa_primaryButton:disabled,._5ikCMa_secondaryButton:disabled,._5ikCMa_dangerButton:disabled,._5ikCMa_addButton:disabled,._5ikCMa_linkButton:disabled,._5ikCMa_addModelButton:disabled{opacity:.4;cursor:default}._5ikCMa_primaryButton:focus-visible,._5ikCMa_secondaryButton:focus-visible,._5ikCMa_dangerButton:focus-visible,._5ikCMa_addButton:focus-visible,._5ikCMa_linkButton:focus-visible,._5ikCMa_addModelButton:focus-visible,._5ikCMa_iconButton:focus-visible,._5ikCMa_dragHandle:focus-visible,._5ikCMa_customizedSummary:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-border-l3);outline:none}._5ikCMa_editor{background:var(--dsw-alias-bg-module-platform);border-radius:12px;flex-direction:column;gap:14px;padding:14px 16px;display:flex}._5ikCMa_field{flex-direction:column;gap:6px;display:flex}._5ikCMa_fieldLabel{color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:12px;font-weight:500;line-height:18px;display:inline-flex}._5ikCMa_linkButton{box-sizing:border-box;height:28px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:14px;align-items:center;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}._5ikCMa_linkButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}._5ikCMa_advancedHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}._5ikCMa_helpButton{border:.5px solid var(--dsw-alias-border-l3);corner-shape:round;width:16px;height:16px;color:var(--dsw-alias-label-tertiary);font:inherit;text-align:center;cursor:help;background:0 0;border-radius:50%;padding:0;font-size:11px;line-height:15px}._5ikCMa_helpButton:hover,._5ikCMa_helpButton:focus-visible{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-tertiary)}._5ikCMa_editorActions{justify-content:flex-end;gap:8px;display:flex}._5ikCMa_addBlock{flex-direction:column;gap:12px;display:flex}._5ikCMa_addActions{flex-wrap:wrap;gap:10px;display:flex}._5ikCMa_addButton{border:1px dashed var(--dsw-alias-border-l3);border-radius:16px;flex:1 1 0;gap:6px;min-width:180px;height:44px}._5ikCMa_addCard{background:var(--dsw-alias-bg-module-platform);border-radius:12px;flex-direction:column;gap:14px;padding:14px 16px;list-style:none;display:flex}._5ikCMa_addCard ._5ikCMa_editor,._5ikCMa_setupCard ._5ikCMa_editor{background:0 0;padding:0}._5ikCMa_tabs{flex-direction:column;gap:12px;display:flex}._5ikCMa_tabBar{border-bottom:.5px solid var(--dsw-alias-border-l2);gap:4px;display:flex}._5ikCMa_tabButton{appearance:none;font:inherit;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:6px 12px 8px;font-size:13px;line-height:20px;position:relative}._5ikCMa_tabButton:hover{color:var(--dsw-alias-label-primary)}._5ikCMa_tabButton:disabled{opacity:.4;cursor:default}._5ikCMa_tabButtonActive{color:var(--dsw-alias-label-primary);font-weight:500}._5ikCMa_tabButtonActive:after{content:\"\";background:var(--dsw-alias-brand-primary);border-radius:2px;height:2px;position:absolute;bottom:-1px;left:10px;right:10px}._5ikCMa_tabPanel{flex-direction:column;gap:12px;display:flex}._5ikCMa_modelCatalog{flex-direction:column;gap:10px;display:flex}._5ikCMa_modelCatalogHeading{flex-direction:column;gap:2px;display:flex}._5ikCMa_modelCatalogTitle{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px}._5ikCMa_modelCatalogMeta,._5ikCMa_modelEmpty{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}._5ikCMa_modelList{flex-direction:column;gap:8px;display:flex}._5ikCMa_modelListHead{justify-content:space-between;align-items:flex-start;gap:12px;display:flex}._5ikCMa_modelEntry{border:.5px solid var(--dsw-alias-border-l4);border-radius:10px;padding:6px}._5ikCMa_modelRow{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) auto auto auto;align-items:center;gap:6px;display:grid;position:relative}._5ikCMa_modelEntryDragging{border:.5px solid var(--dsw-alias-border-l4);opacity:.5;border-radius:10px;padding:6px}._5ikCMa_dragHandle{box-sizing:border-box;width:24px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:grab;touch-action:none;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;display:inline-flex}._5ikCMa_dragHandle:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}._5ikCMa_dragHandle:active:not(:disabled){cursor:grabbing}._5ikCMa_dragHandle:disabled{cursor:default;opacity:.4}._5ikCMa_modelDropLine{background:var(--dsw-alias-brand-primary);pointer-events:none;border-radius:2px;height:2px;position:absolute;left:0;right:0}._5ikCMa_modelDropLine[data-edge=before]{top:-5px}._5ikCMa_modelDropLine[data-edge=after]{bottom:-5px}._5ikCMa_iconButton{box-sizing:border-box;width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;display:inline-flex}._5ikCMa_iconButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}._5ikCMa_iconButton:disabled{cursor:default;opacity:.4}._5ikCMa_iconButtonDanger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary)}._5ikCMa_modelAdvanced{grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:8px;padding:8px 4px 2px;display:grid}._5ikCMa_capacityRow{grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:8px;padding:0 4px;display:grid}._5ikCMa_modelField{flex-direction:column;gap:4px;display:flex}._5ikCMa_modelFieldLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._5ikCMa_modelEmpty{border:1px dashed var(--dsw-alias-border-l3);text-align:center;border-radius:8px;padding:12px}._5ikCMa_addModelButton{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);height:28px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border-radius:14px;align-self:flex-start;align-items:center;gap:4px;padding:0 10px;font-size:12px;line-height:18px;display:inline-flex}._5ikCMa_addModelButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._5ikCMa_input{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);width:100%;height:32px;font:inherit;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 10px;font-size:14px;line-height:22px}select._5ikCMa_input{cursor:pointer;max-width:240px}._5ikCMa_input:focus{border-color:var(--dsw-alias-brand-primary);outline:none}._5ikCMa_input::placeholder{color:var(--dsw-alias-label-dimmed)}._5ikCMa_input:disabled{opacity:.6;cursor:default}._5ikCMa_keyInput{position:relative}._5ikCMa_keyInputFilled{padding-right:40px}._5ikCMa_keyToggle{border-radius:var(--dsw-radius-md);width:32px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:absolute;inset:1px 1px 1px auto}._5ikCMa_keyToggle:hover:not(:disabled){color:var(--dsw-alias-label-primary)}._5ikCMa_keyToggle:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._5ikCMa_keyToggle:disabled{opacity:.6;cursor:default}._5ikCMa_selectInput{appearance:none;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E\");background-position:right 12px center;background-repeat:no-repeat;background-size:12px 12px;padding-right:32px}._5ikCMa_deleteDialog{width:min(480px,100%)}._5ikCMa_deleteConfirm:not(:disabled){border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}._5ikCMa_deleteConfirm:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger)}._5ikCMa_fetchDialog{max-width:520px}._5ikCMa_candidateToolbar{align-items:center;gap:8px;margin-bottom:6px;display:flex}._5ikCMa_candidateSearch{flex:240px;min-width:0}._5ikCMa_candidateList{flex-direction:column;gap:2px;max-height:320px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}._5ikCMa_candidate{border-radius:6px}._5ikCMa_candidateLabel{cursor:pointer;align-items:center;gap:8px;padding:6px 8px;display:flex}._5ikCMa_candidateId{overflow-wrap:anywhere;flex:auto;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px}._5ikCMa_candidateEmpty{color:var(--dsw-alias-label-secondary);text-align:center;margin:24px 0;font-size:13px;line-height:20px}[hidden]{display:none!important}._5ikCMa_extBlock{border:.5px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-layer-1);border-radius:10px;flex-direction:column;gap:10px;margin:8px 4px 2px;padding:10px;display:flex}._5ikCMa_extGroup{border-top:.5px solid var(--dsw-alias-border-l2);padding-top:12px}._5ikCMa_extGroupFirst{border-top:none;padding-top:0}._5ikCMa_extCheck{cursor:pointer;align-items:flex-start;gap:8px;display:flex}._5ikCMa_extCheckLabel{color:var(--dsw-alias-label-primary);font-size:14px;line-height:22px}._5ikCMa_extHint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._5ikCMa_extGated{flex-direction:column;gap:12px;padding-left:2px;display:flex}._5ikCMa_extField{flex-direction:column;gap:6px;display:flex}._5ikCMa_extLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._5ikCMa_extTable{border:.5px solid var(--dsw-alias-border-l4);border-radius:8px;overflow:hidden}._5ikCMa_extTHead{color:var(--dsw-alias-label-tertiary);background:var(--dsw-alias-bg-module-platform);grid-template-columns:64px minmax(0,1fr) minmax(0,1.2fr);font-size:12px;line-height:18px;display:grid}._5ikCMa_extTHead>div{padding:6px 10px}._5ikCMa_extTHead>div+div{border-left:.5px solid var(--dsw-alias-border-l2)}._5ikCMa_extTRow{border-top:.5px solid var(--dsw-alias-border-l2);grid-template-columns:64px minmax(0,1fr) minmax(0,1.2fr);align-items:center;display:grid}._5ikCMa_extTRow>div{padding:6px 10px;font-size:14px}._5ikCMa_extTRow>div+div{border-left:.5px solid var(--dsw-alias-border-l2)}._5ikCMa_extTRow input[type=text]{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);width:100%;height:32px;font:inherit;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 10px;font-size:14px}._5ikCMa_extTRow input[type=text]:disabled{opacity:.6;cursor:default}._5ikCMa_extCheckbox{accent-color:var(--dsw-alias-brand-primary);flex:none;width:15px;height:15px}._5ikCMa_switchRow{cursor:pointer;align-items:center;gap:8px;font-size:14px;line-height:22px;display:flex}._5ikCMa_extTag{background:var(--dsw-static-deepseek-100);color:var(--dsw-static-deepseek-600);border:.5px solid #4176e659;border-radius:4px;flex:none;padding:1px 6px;font-size:11px;font-weight:500;line-height:16px}._5ikCMa_modalMask{background:var(--dsw-alias-bg-mask-1);z-index:100;justify-content:center;align-items:center;padding:24px;display:flex;position:fixed;inset:0}._5ikCMa_modal{background:var(--dsw-specific-menu);border-radius:16px;width:100%;padding:20px;box-shadow:0 12px 40px #0000002e}._5ikCMa_modalTitle{color:var(--dsw-alias-label-primary);margin-bottom:8px;font-size:16px;font-weight:500;line-height:24px}._5ikCMa_modalDesc{color:var(--dsw-alias-label-secondary);margin-bottom:16px;font-size:14px;line-height:22px}._5ikCMa_modalFoot{justify-content:flex-end;gap:8px;display:flex}._5ikCMa_quickWrap{flex-direction:column;gap:6px;display:flex;position:relative}._5ikCMa_quickList{z-index:20;background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);border:0;border-radius:8px;max-height:264px;margin-top:2px;padding:4px;position:absolute;top:100%;left:0;right:0;overflow-y:auto}._5ikCMa_quickItem{width:100%;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;flex-direction:column;gap:1px;padding:6px 8px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;display:flex}._5ikCMa_quickItemId{overflow-wrap:anywhere}._5ikCMa_quickItemApi{color:var(--dsw-alias-label-tertiary);letter-spacing:.2px;font-size:11px;line-height:14px}._5ikCMa_quickItem:hover{background:var(--dsw-alias-interactive-bg-hover)}._5ikCMa_quickEmpty{color:var(--dsw-alias-label-tertiary);padding:6px 8px;font-size:12px;line-height:18px}@media (prefers-reduced-motion:reduce){._5ikCMa_customizedSummary:before{transition:none}}\n";
|
|
7
7
|
if (typeof document !== 'undefined' && document.querySelector('style[data-plugin-css="dsh-model-extension"]') === null) {
|
|
8
8
|
var __tag = document.createElement('style');
|
|
9
9
|
__tag.dataset.plugin = "dsh-model-extension";
|
|
@@ -38,6 +38,9 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
38
38
|
settingsPath: [...entry.settingsPath],
|
|
39
39
|
active: active.has(entry.provider),
|
|
40
40
|
...entry.declared === void 0 ? {} : { declared: entry.declared },
|
|
41
|
+
...entry.defaultBaseURL === void 0 ? {} : { defaultBaseURL: entry.defaultBaseURL },
|
|
42
|
+
...entry.baseURLEnv === void 0 ? {} : { baseURLEnv: entry.baseURLEnv },
|
|
43
|
+
...entry.nativeAuth === void 0 ? {} : { nativeAuth: entry.nativeAuth },
|
|
41
44
|
...entry.error === void 0 ? {} : { error: entry.error }
|
|
42
45
|
}));
|
|
43
46
|
for (const provider of registered) {
|
|
@@ -105,6 +108,8 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
105
108
|
});
|
|
106
109
|
/** Latest load wins; an older response never overwrites a newer one. */
|
|
107
110
|
generation = 0;
|
|
111
|
+
/** Callers follow the current refresh's outcome, including callers whose read was superseded. */
|
|
112
|
+
pendingLoads = /* @__PURE__ */ new Set();
|
|
108
113
|
/**
|
|
109
114
|
* @param ctx - the page plugin's context, whose `remote.llm` and
|
|
110
115
|
* `remote.credentials` namespaces carry the directory and credential reads.
|
|
@@ -121,11 +126,28 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
121
126
|
* settings answer in parallel, then one batched credential describe over
|
|
122
127
|
* every referenced ref. Provider failure or absence of an initial settings
|
|
123
128
|
* answer keeps the last good rows and surfaces an error; a failed settings
|
|
124
|
-
* refresh reuses the mirror's held view.
|
|
125
|
-
*
|
|
129
|
+
* refresh reuses the mirror's held view. Concurrent callers resolve only
|
|
130
|
+
* after the current refresh publishes its ready or error snapshot.
|
|
131
|
+
* @returns resolution after the current snapshot is published.
|
|
132
|
+
* @throws the current read's unexpected rejection; superseded rejections are ignored.
|
|
126
133
|
*/
|
|
127
|
-
|
|
134
|
+
load() {
|
|
135
|
+
const pending = Promise.withResolvers();
|
|
136
|
+
this.pendingLoads.add(pending);
|
|
128
137
|
const generation = ++this.generation;
|
|
138
|
+
this.read(generation).then(() => {
|
|
139
|
+
this.settleLoads(generation, (load) => {
|
|
140
|
+
load.resolve();
|
|
141
|
+
});
|
|
142
|
+
}, (error) => {
|
|
143
|
+
this.settleLoads(generation, (load) => {
|
|
144
|
+
load.reject(error);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
return pending.promise;
|
|
148
|
+
}
|
|
149
|
+
/** Publish one joined answer; stale answers leave the current refresh in charge. */
|
|
150
|
+
async read(generation) {
|
|
129
151
|
this.store.update((s) => {
|
|
130
152
|
s.status = "loading";
|
|
131
153
|
s.error = null;
|
|
@@ -135,17 +157,20 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
135
157
|
this.ctx.remote.llm.listConfigurableProviders(),
|
|
136
158
|
this.describeFace.ensure()
|
|
137
159
|
]);
|
|
160
|
+
if (generation !== this.generation) return;
|
|
138
161
|
if (!registered.ok) {
|
|
139
|
-
this.failLoad(
|
|
162
|
+
this.failLoad(registered.error.message);
|
|
140
163
|
return;
|
|
141
164
|
}
|
|
142
165
|
if (!declared.ok) {
|
|
143
|
-
this.failLoad(
|
|
166
|
+
this.failLoad(declared.error.message);
|
|
144
167
|
return;
|
|
145
168
|
}
|
|
146
169
|
const mirrored = this.describeFace.getSnapshot();
|
|
147
170
|
if (mirrored.view === void 0) {
|
|
148
|
-
|
|
171
|
+
/* v8 ignore next -- SettingsDescribeFace.ensure settles with a view or the read's error */
|
|
172
|
+
if (mirrored.error === null) throw new Error("settings describe settled with neither a view nor an error");
|
|
173
|
+
this.failLoad(mirrored.error);
|
|
149
174
|
return;
|
|
150
175
|
}
|
|
151
176
|
const providers = joinProviderDirectory(registered.value, declared.value);
|
|
@@ -166,13 +191,16 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
166
191
|
const catalog = await this.ctx.remote.session.modelCatalog();
|
|
167
192
|
for (const row of rows) if (row.entry.provider === "deepseek-account") row.accountAvailable = catalog.ok && catalog.value.groups.some((group) => group.id === "deepseek-account" && group.models.length > 0);
|
|
168
193
|
}
|
|
169
|
-
const refs = [...new Set(rows.filter((row) => row.entry.provider !== "deepseek-account").
|
|
170
|
-
|
|
194
|
+
const refs = [...new Set(rows.filter((row) => row.entry.provider !== "deepseek-account").flatMap((row) => row.apiKeyEnv === void 0 ? [deriveKeyRef(row.entry.provider), ...row.entry.nativeAuth?.env ?? []] : [row.apiKeyEnv]))];
|
|
195
|
+
const credentials = {};
|
|
171
196
|
let credentialError = null;
|
|
172
|
-
|
|
173
|
-
const response = await this.ctx.remote.credentials.describe(refs);
|
|
174
|
-
if (response.ok) credentials
|
|
175
|
-
else
|
|
197
|
+
for (let index = 0; index < refs.length; index += 64) {
|
|
198
|
+
const response = await this.ctx.remote.credentials.describe(refs.slice(index, index + 64));
|
|
199
|
+
if (response.ok) Object.assign(credentials, response.value);
|
|
200
|
+
else {
|
|
201
|
+
credentialError = response.error.message;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
176
204
|
}
|
|
177
205
|
if (generation !== this.generation) return;
|
|
178
206
|
this.store.update((s) => {
|
|
@@ -187,15 +215,25 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
187
215
|
return {
|
|
188
216
|
...row,
|
|
189
217
|
...named === void 0 ? {} : { credential: named },
|
|
190
|
-
...derived === void 0 ? {} : { derivedCredential: derived }
|
|
218
|
+
...derived === void 0 ? {} : { derivedCredential: derived },
|
|
219
|
+
...credentialError === null ? { credentialChecks: Object.fromEntries((row.apiKeyEnv === void 0 ? row.entry.nativeAuth?.env ?? [] : [row.apiKeyEnv]).flatMap((ref) => {
|
|
220
|
+
const info = credentials[ref];
|
|
221
|
+
return info === void 0 ? [] : [[ref, info]];
|
|
222
|
+
})) } : {}
|
|
191
223
|
};
|
|
192
224
|
});
|
|
193
225
|
s.namespaces = namespaces;
|
|
194
226
|
});
|
|
195
227
|
}
|
|
196
|
-
/**
|
|
197
|
-
|
|
228
|
+
/** Settle callers only while this read still owns the current refresh. */
|
|
229
|
+
settleLoads(generation, settle) {
|
|
198
230
|
if (generation !== this.generation) return;
|
|
231
|
+
const pending = [...this.pendingLoads];
|
|
232
|
+
this.pendingLoads.clear();
|
|
233
|
+
for (const load of pending) settle(load);
|
|
234
|
+
}
|
|
235
|
+
/** Publish the current joined read's failure text. */
|
|
236
|
+
failLoad(message) {
|
|
199
237
|
this.store.update((s) => {
|
|
200
238
|
s.status = "error";
|
|
201
239
|
s.error = message;
|
|
@@ -482,7 +520,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
482
520
|
* was last verified against, and the extra locale keys the extension adds on
|
|
483
521
|
* top of the official Models page dictionaries.
|
|
484
522
|
*/
|
|
485
|
-
/** Thinking levels offered by llm-pi-ai (THINKING_LEVEL_GATE @ 0.1.2
|
|
523
|
+
/** Thinking levels offered by llm-pi-ai (THINKING_LEVEL_GATE @ 0.2.1-rc.2). Only `off` may carry an empty wire value. */
|
|
486
524
|
const THINKING_LEVELS = [
|
|
487
525
|
"off",
|
|
488
526
|
"minimal",
|
|
@@ -492,7 +530,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
492
530
|
"xhigh",
|
|
493
531
|
"max"
|
|
494
532
|
];
|
|
495
|
-
/** Reasoning wire formats understood by llm-pi-ai (SUPPORTED_THINKING_FORMATS @ 0.1.2
|
|
533
|
+
/** Reasoning wire formats understood by llm-pi-ai (SUPPORTED_THINKING_FORMATS @ 0.2.1-rc.2). */
|
|
496
534
|
const THINKING_FORMATS = [
|
|
497
535
|
"openai",
|
|
498
536
|
"deepseek",
|
|
@@ -508,7 +546,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
508
546
|
];
|
|
509
547
|
/**
|
|
510
548
|
* The compatibility switches llm-pi-ai *offers*, by wire protocol (the `offer`
|
|
511
|
-
* set of its COMPAT_GATES @ 0.1
|
|
549
|
+
* set of its COMPAT_GATES @ 0.2.1-rc.2). Only these may reach a model row: the
|
|
512
550
|
* adapter refuses a switch no protocol offers rather than ignoring it, so
|
|
513
551
|
* copying pi-ai's catalog `compat` across verbatim would fail resolution on
|
|
514
552
|
* the withheld fields it also records (routing preferences, session affinity,
|
|
@@ -629,12 +667,25 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
629
667
|
retry: "Retry",
|
|
630
668
|
keyInput: "API key",
|
|
631
669
|
keyPlaceholder: "Enter your API key",
|
|
632
|
-
|
|
633
|
-
|
|
670
|
+
keyPlaceholderFallback: "Leave blank to use env as auth ({hint})",
|
|
671
|
+
keyPlaceholderSaved: "Leave blank to use saved credentials",
|
|
672
|
+
keyFallbackMissing: "Env var not detected. Enter an API key, or configure {hint} in your env.",
|
|
673
|
+
keyFallbackDetected: "Env var detected. ({hint})",
|
|
674
|
+
keyFallbackDetectedHidden: "Env var detected.",
|
|
675
|
+
keyFallbackUnchecked: "Environment credential status has not been confirmed.",
|
|
676
|
+
keyHelp: "Saved credentials are used first. Environment fallbacks shown here, in order: {env}. Sources are launch environment, $cwd/.env, then $DSH_HOME/.env.",
|
|
677
|
+
authHelp: "Authentication details",
|
|
678
|
+
keyReveal: "Show secret",
|
|
679
|
+
keyHide: "Hide secret",
|
|
634
680
|
keyEnvLocked: "Provided by the launch environment (read-only)",
|
|
635
681
|
customized: "Customized settings",
|
|
636
682
|
baseUrl: "Base URL",
|
|
637
|
-
baseUrlDefault: "
|
|
683
|
+
baseUrlDefault: "No default endpoint",
|
|
684
|
+
baseUrlEnvironment: "Provider endpoint configuration: {env}",
|
|
685
|
+
baseUrlConfigured: "Provider-configured endpoint",
|
|
686
|
+
baseUrlPlaceholder: "{url}",
|
|
687
|
+
accountSignedIn: "Signed in",
|
|
688
|
+
accountReadOnly: "The account catalog comes from the account /models listing; per-model overrides live under modelOverrides in cordis.patch.yml.",
|
|
638
689
|
models: "Models",
|
|
639
690
|
modelsInherited: "Using the adapter defaults",
|
|
640
691
|
modelsCustomized: "Customized model catalog",
|
|
@@ -742,12 +793,25 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
742
793
|
retry: "重试",
|
|
743
794
|
keyInput: "API 密钥",
|
|
744
795
|
keyPlaceholder: "输入 API 密钥",
|
|
745
|
-
|
|
746
|
-
|
|
796
|
+
keyPlaceholderFallback: "留空使用环境认证({hint})",
|
|
797
|
+
keyPlaceholderSaved: "留空使用已保存凭据",
|
|
798
|
+
keyFallbackMissing: "未检测到环境变量。请填写 API 密钥,或设置环境变量 {hint}。",
|
|
799
|
+
keyFallbackDetected: "已检测到环境变量({hint})",
|
|
800
|
+
keyFallbackDetectedHidden: "已检测到环境变量",
|
|
801
|
+
keyFallbackUnchecked: "环境凭据状态尚未确认",
|
|
802
|
+
keyHelp: "优先使用已保存的凭据。此处显示的环境后备按以下顺序排列:{env}。来源依次为启动环境、$cwd/.env、$DSH_HOME/.env。",
|
|
803
|
+
authHelp: "认证说明",
|
|
804
|
+
keyReveal: "显示密钥",
|
|
805
|
+
keyHide: "隐藏密钥",
|
|
747
806
|
keyEnvLocked: "由启动环境提供(只读)",
|
|
748
807
|
customized: "自定义设置",
|
|
749
808
|
baseUrl: "API 地址",
|
|
750
|
-
baseUrlDefault: "
|
|
809
|
+
baseUrlDefault: "没有默认地址",
|
|
810
|
+
baseUrlEnvironment: "提供方地址配置:{env}",
|
|
811
|
+
baseUrlConfigured: "由提供方配置地址",
|
|
812
|
+
baseUrlPlaceholder: "{url}",
|
|
813
|
+
accountSignedIn: "已登录",
|
|
814
|
+
accountReadOnly: "账号模型目录来自账号 /models 列表;单模型覆盖请在 cordis.patch.yml 的 modelOverrides 中配置。",
|
|
751
815
|
models: "模型目录",
|
|
752
816
|
modelsInherited: "正在使用适配器默认模型",
|
|
753
817
|
modelsCustomized: "已自定义模型目录",
|
|
@@ -1010,6 +1074,202 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
1010
1074
|
}
|
|
1011
1075
|
}
|
|
1012
1076
|
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Whether pi-ai accepts one stored wire value: a non-empty string, or `null`
|
|
1079
|
+
* for the `off` level (which sends nothing).
|
|
1080
|
+
* @param level - the declared level.
|
|
1081
|
+
* @param wire - the value stored for it.
|
|
1082
|
+
* @returns whether the adapter would resolve the entry.
|
|
1083
|
+
*/
|
|
1084
|
+
function acceptedReasoningValue(level, wire) {
|
|
1085
|
+
return typeof wire === "string" ? wire.length > 0 : wire === null && level === "off";
|
|
1086
|
+
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Mirror the adapter's own refusals for a hand-declared `reasoningEfforts`
|
|
1089
|
+
* field, so a card names the row instead of failing at write time.
|
|
1090
|
+
*
|
|
1091
|
+
* A declaration is refused when a non-off level carries an empty value (or a
|
|
1092
|
+
* non-string that is not `off`'s `null`), and when it declares no level
|
|
1093
|
+
* beyond `off`. An absent or `false` field means "does not reason" and
|
|
1094
|
+
* passes; a `null` or `{}` field is a valueless declaration and is refused
|
|
1095
|
+
* the same way the adapter refuses it.
|
|
1096
|
+
* @param value - drafted `models` value, or undefined while inherited.
|
|
1097
|
+
* @returns the first refused row, or undefined when the adapter accepts every row.
|
|
1098
|
+
*/
|
|
1099
|
+
function validateReasoningEfforts(value) {
|
|
1100
|
+
for (const [index, model] of modelDrafts(value).entries()) {
|
|
1101
|
+
const raw = model["reasoningEfforts"];
|
|
1102
|
+
if (raw === void 0 || raw === false) continue;
|
|
1103
|
+
const entries = raw === null ? [] : typeof raw === "object" && !Array.isArray(raw) ? Object.entries(raw) : void 0;
|
|
1104
|
+
if (entries === void 0) continue;
|
|
1105
|
+
if (entries.some(([level, wire]) => !acceptedReasoningValue(level, wire))) return {
|
|
1106
|
+
index,
|
|
1107
|
+
key: "modelReasoningValueRequired"
|
|
1108
|
+
};
|
|
1109
|
+
if (!entries.some(([level]) => level !== "off")) return {
|
|
1110
|
+
index,
|
|
1111
|
+
key: "modelReasoningNeedsLevel"
|
|
1112
|
+
};
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
//#endregion
|
|
1116
|
+
//#region src/client/models-plus/models-plus.module.css
|
|
1117
|
+
var models_plus_module_default = {
|
|
1118
|
+
"accountStatus": "_5ikCMa_accountStatus",
|
|
1119
|
+
"addActions": "_5ikCMa_addActions",
|
|
1120
|
+
"addBlock": "_5ikCMa_addBlock",
|
|
1121
|
+
"addButton": "_5ikCMa_addButton",
|
|
1122
|
+
"addCard": "_5ikCMa_addCard",
|
|
1123
|
+
"addModelButton": "_5ikCMa_addModelButton",
|
|
1124
|
+
"advancedHint": "_5ikCMa_advancedHint",
|
|
1125
|
+
"candidate": "_5ikCMa_candidate",
|
|
1126
|
+
"candidateEmpty": "_5ikCMa_candidateEmpty",
|
|
1127
|
+
"candidateId": "_5ikCMa_candidateId",
|
|
1128
|
+
"candidateLabel": "_5ikCMa_candidateLabel",
|
|
1129
|
+
"candidateList": "_5ikCMa_candidateList",
|
|
1130
|
+
"candidateSearch": "_5ikCMa_candidateSearch",
|
|
1131
|
+
"candidateToolbar": "_5ikCMa_candidateToolbar",
|
|
1132
|
+
"capacityRow": "_5ikCMa_capacityRow",
|
|
1133
|
+
"credentialDot": "_5ikCMa_credentialDot",
|
|
1134
|
+
"credentialDotConfigured": "_5ikCMa_credentialDotConfigured",
|
|
1135
|
+
"credentialDotMissing": "_5ikCMa_credentialDotMissing",
|
|
1136
|
+
"customizedSummary": "_5ikCMa_customizedSummary",
|
|
1137
|
+
"dangerButton": "_5ikCMa_dangerButton",
|
|
1138
|
+
"deleteConfirm": "_5ikCMa_deleteConfirm",
|
|
1139
|
+
"deleteDialog": "_5ikCMa_deleteDialog",
|
|
1140
|
+
"dragHandle": "_5ikCMa_dragHandle",
|
|
1141
|
+
"editor": "_5ikCMa_editor",
|
|
1142
|
+
"editorActions": "_5ikCMa_editorActions",
|
|
1143
|
+
"error": "_5ikCMa_error",
|
|
1144
|
+
"extBlock": "_5ikCMa_extBlock",
|
|
1145
|
+
"extCheck": "_5ikCMa_extCheck",
|
|
1146
|
+
"extCheckbox": "_5ikCMa_extCheckbox",
|
|
1147
|
+
"extCheckLabel": "_5ikCMa_extCheckLabel",
|
|
1148
|
+
"extField": "_5ikCMa_extField",
|
|
1149
|
+
"extGated": "_5ikCMa_extGated",
|
|
1150
|
+
"extGroup": "_5ikCMa_extGroup",
|
|
1151
|
+
"extGroupFirst": "_5ikCMa_extGroupFirst",
|
|
1152
|
+
"extHint": "_5ikCMa_extHint",
|
|
1153
|
+
"extLabel": "_5ikCMa_extLabel",
|
|
1154
|
+
"extTable": "_5ikCMa_extTable",
|
|
1155
|
+
"extTag": "_5ikCMa_extTag",
|
|
1156
|
+
"extTHead": "_5ikCMa_extTHead",
|
|
1157
|
+
"extTRow": "_5ikCMa_extTRow",
|
|
1158
|
+
"fetchDialog": "_5ikCMa_fetchDialog",
|
|
1159
|
+
"field": "_5ikCMa_field",
|
|
1160
|
+
"fieldLabel": "_5ikCMa_fieldLabel",
|
|
1161
|
+
"helpButton": "_5ikCMa_helpButton",
|
|
1162
|
+
"iconButton": "_5ikCMa_iconButton",
|
|
1163
|
+
"iconButtonDanger": "_5ikCMa_iconButtonDanger",
|
|
1164
|
+
"input": "_5ikCMa_input",
|
|
1165
|
+
"intro": "_5ikCMa_intro",
|
|
1166
|
+
"keyInput": "_5ikCMa_keyInput",
|
|
1167
|
+
"keyInputFilled": "_5ikCMa_keyInputFilled",
|
|
1168
|
+
"keyToggle": "_5ikCMa_keyToggle",
|
|
1169
|
+
"linkButton": "_5ikCMa_linkButton",
|
|
1170
|
+
"modal": "_5ikCMa_modal",
|
|
1171
|
+
"modalDesc": "_5ikCMa_modalDesc",
|
|
1172
|
+
"modalFoot": "_5ikCMa_modalFoot",
|
|
1173
|
+
"modalMask": "_5ikCMa_modalMask",
|
|
1174
|
+
"modalTitle": "_5ikCMa_modalTitle",
|
|
1175
|
+
"modelAdvanced": "_5ikCMa_modelAdvanced",
|
|
1176
|
+
"modelCatalog": "_5ikCMa_modelCatalog",
|
|
1177
|
+
"modelCatalogHeading": "_5ikCMa_modelCatalogHeading",
|
|
1178
|
+
"modelCatalogMeta": "_5ikCMa_modelCatalogMeta",
|
|
1179
|
+
"modelCatalogTitle": "_5ikCMa_modelCatalogTitle",
|
|
1180
|
+
"modelDropLine": "_5ikCMa_modelDropLine",
|
|
1181
|
+
"modelEmpty": "_5ikCMa_modelEmpty",
|
|
1182
|
+
"modelEntry": "_5ikCMa_modelEntry",
|
|
1183
|
+
"modelEntryDragging": "_5ikCMa_modelEntryDragging",
|
|
1184
|
+
"modelField": "_5ikCMa_modelField",
|
|
1185
|
+
"modelFieldLabel": "_5ikCMa_modelFieldLabel",
|
|
1186
|
+
"modelList": "_5ikCMa_modelList",
|
|
1187
|
+
"modelListHead": "_5ikCMa_modelListHead",
|
|
1188
|
+
"modelRow": "_5ikCMa_modelRow",
|
|
1189
|
+
"notice": "_5ikCMa_notice",
|
|
1190
|
+
"primaryButton": "_5ikCMa_primaryButton",
|
|
1191
|
+
"quickEmpty": "_5ikCMa_quickEmpty",
|
|
1192
|
+
"quickItem": "_5ikCMa_quickItem",
|
|
1193
|
+
"quickItemApi": "_5ikCMa_quickItemApi",
|
|
1194
|
+
"quickItemId": "_5ikCMa_quickItemId",
|
|
1195
|
+
"quickList": "_5ikCMa_quickList",
|
|
1196
|
+
"quickWrap": "_5ikCMa_quickWrap",
|
|
1197
|
+
"rowActions": "_5ikCMa_rowActions",
|
|
1198
|
+
"rowCard": "_5ikCMa_rowCard",
|
|
1199
|
+
"rowHead": "_5ikCMa_rowHead",
|
|
1200
|
+
"rowIdentity": "_5ikCMa_rowIdentity",
|
|
1201
|
+
"rowName": "_5ikCMa_rowName",
|
|
1202
|
+
"rows": "_5ikCMa_rows",
|
|
1203
|
+
"rowTag": "_5ikCMa_rowTag",
|
|
1204
|
+
"savedNotice": "_5ikCMa_savedNotice",
|
|
1205
|
+
"secondaryButton": "_5ikCMa_secondaryButton",
|
|
1206
|
+
"section": "_5ikCMa_section",
|
|
1207
|
+
"selectInput": "_5ikCMa_selectInput",
|
|
1208
|
+
"setupCard": "_5ikCMa_setupCard",
|
|
1209
|
+
"switchRow": "_5ikCMa_switchRow",
|
|
1210
|
+
"tabBar": "_5ikCMa_tabBar",
|
|
1211
|
+
"tabButton": "_5ikCMa_tabButton",
|
|
1212
|
+
"tabButtonActive": "_5ikCMa_tabButtonActive",
|
|
1213
|
+
"tabPanel": "_5ikCMa_tabPanel",
|
|
1214
|
+
"tabs": "_5ikCMa_tabs",
|
|
1215
|
+
"title": "_5ikCMa_title",
|
|
1216
|
+
"titleRow": "_5ikCMa_titleRow"
|
|
1217
|
+
};
|
|
1218
|
+
//#endregion
|
|
1219
|
+
//#region src/client/models-plus/ApiKeyInput.tsx
|
|
1220
|
+
/**
|
|
1221
|
+
* Write-only credential input with the same reveal behavior as masked
|
|
1222
|
+
* conversation text (mirrors the host ApiKeyInput @ 0.2.1-alpha.4).
|
|
1223
|
+
* A different value starts masked again, so a revealed secret never survives
|
|
1224
|
+
* an edit; `new-password` keeps a password manager from filling a derived
|
|
1225
|
+
* reference name into the field.
|
|
1226
|
+
*/
|
|
1227
|
+
const EYE_CONTOUR = "M1.5 8C2.9 5.25 5.25 3.5 8 3.5C10.75 3.5 13.1 5.25 14.5 8C13.1 10.75 10.75 12.5 8 12.5C5.25 12.5 2.9 10.75 1.5 8Z";
|
|
1228
|
+
const EYE_PATH = `${EYE_CONTOUR}M10 8C10 9.1 9.1 10 8 10C6.9 10 6 9.1 6 8C6 6.9 6.9 6 8 6C9.1 6 10 6.9 10 8Z`;
|
|
1229
|
+
const EYE_OFF_PATH = `${EYE_CONTOUR}M2.5 2.5L13.5 13.5`;
|
|
1230
|
+
/**
|
|
1231
|
+
* Reveal only a nonempty draft; a different value starts masked, as in the host field.
|
|
1232
|
+
* @param props - current draft, input attributes, and translated control labels.
|
|
1233
|
+
* @returns a password input with an optional reveal button.
|
|
1234
|
+
*/
|
|
1235
|
+
function ApiKeyInput({ value, t, ...props }) {
|
|
1236
|
+
const [revealedValue, setRevealedValue] = (0, react.useState)();
|
|
1237
|
+
const revealed = value.length > 0 && revealedValue === value;
|
|
1238
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1239
|
+
className: models_plus_module_default["keyInput"],
|
|
1240
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1241
|
+
...props,
|
|
1242
|
+
className: `${models_plus_module_default["input"]} ${value.length > 0 ? models_plus_module_default["keyInputFilled"] : ""}`,
|
|
1243
|
+
type: revealed ? "text" : "password",
|
|
1244
|
+
autoComplete: "new-password",
|
|
1245
|
+
value,
|
|
1246
|
+
onChange: (event) => {
|
|
1247
|
+
setRevealedValue(void 0);
|
|
1248
|
+
props.onChange?.(event);
|
|
1249
|
+
}
|
|
1250
|
+
}), value.length === 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1251
|
+
type: "button",
|
|
1252
|
+
className: models_plus_module_default["keyToggle"],
|
|
1253
|
+
"aria-label": t(revealed ? "keyHide" : "keyReveal"),
|
|
1254
|
+
"aria-pressed": revealed,
|
|
1255
|
+
disabled: props.disabled,
|
|
1256
|
+
onClick: () => {
|
|
1257
|
+
setRevealedValue(revealed ? void 0 : value);
|
|
1258
|
+
},
|
|
1259
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1260
|
+
width: "16",
|
|
1261
|
+
height: "16",
|
|
1262
|
+
viewBox: "0 0 16 16",
|
|
1263
|
+
fill: "none",
|
|
1264
|
+
stroke: "currentColor",
|
|
1265
|
+
strokeWidth: 1.3,
|
|
1266
|
+
strokeLinecap: "round",
|
|
1267
|
+
"aria-hidden": "true",
|
|
1268
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: revealed ? EYE_OFF_PATH : EYE_PATH })
|
|
1269
|
+
})
|
|
1270
|
+
})]
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1013
1273
|
//#endregion
|
|
1014
1274
|
//#region src/client/models-plus/presets.ts
|
|
1015
1275
|
/**
|
|
@@ -1167,102 +1427,6 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
1167
1427
|
return next;
|
|
1168
1428
|
}
|
|
1169
1429
|
//#endregion
|
|
1170
|
-
//#region src/client/models-plus/models-plus.module.css
|
|
1171
|
-
var models_plus_module_default = {
|
|
1172
|
-
"addActions": "_5ikCMa_addActions",
|
|
1173
|
-
"addBlock": "_5ikCMa_addBlock",
|
|
1174
|
-
"addButton": "_5ikCMa_addButton",
|
|
1175
|
-
"addCard": "_5ikCMa_addCard",
|
|
1176
|
-
"addModelButton": "_5ikCMa_addModelButton",
|
|
1177
|
-
"advancedHint": "_5ikCMa_advancedHint",
|
|
1178
|
-
"candidate": "_5ikCMa_candidate",
|
|
1179
|
-
"candidateEmpty": "_5ikCMa_candidateEmpty",
|
|
1180
|
-
"candidateId": "_5ikCMa_candidateId",
|
|
1181
|
-
"candidateLabel": "_5ikCMa_candidateLabel",
|
|
1182
|
-
"candidateList": "_5ikCMa_candidateList",
|
|
1183
|
-
"candidateSearch": "_5ikCMa_candidateSearch",
|
|
1184
|
-
"candidateToolbar": "_5ikCMa_candidateToolbar",
|
|
1185
|
-
"credentialDot": "_5ikCMa_credentialDot",
|
|
1186
|
-
"credentialDotConfigured": "_5ikCMa_credentialDotConfigured",
|
|
1187
|
-
"credentialDotMissing": "_5ikCMa_credentialDotMissing",
|
|
1188
|
-
"customizedSummary": "_5ikCMa_customizedSummary",
|
|
1189
|
-
"dangerButton": "_5ikCMa_dangerButton",
|
|
1190
|
-
"deleteConfirm": "_5ikCMa_deleteConfirm",
|
|
1191
|
-
"deleteDialog": "_5ikCMa_deleteDialog",
|
|
1192
|
-
"dragHandle": "_5ikCMa_dragHandle",
|
|
1193
|
-
"editor": "_5ikCMa_editor",
|
|
1194
|
-
"editorActions": "_5ikCMa_editorActions",
|
|
1195
|
-
"error": "_5ikCMa_error",
|
|
1196
|
-
"extBlock": "_5ikCMa_extBlock",
|
|
1197
|
-
"extCheck": "_5ikCMa_extCheck",
|
|
1198
|
-
"extCheckbox": "_5ikCMa_extCheckbox",
|
|
1199
|
-
"extCheckLabel": "_5ikCMa_extCheckLabel",
|
|
1200
|
-
"extField": "_5ikCMa_extField",
|
|
1201
|
-
"extGated": "_5ikCMa_extGated",
|
|
1202
|
-
"extGroup": "_5ikCMa_extGroup",
|
|
1203
|
-
"extGroupFirst": "_5ikCMa_extGroupFirst",
|
|
1204
|
-
"extHint": "_5ikCMa_extHint",
|
|
1205
|
-
"extLabel": "_5ikCMa_extLabel",
|
|
1206
|
-
"extTable": "_5ikCMa_extTable",
|
|
1207
|
-
"extTag": "_5ikCMa_extTag",
|
|
1208
|
-
"extTHead": "_5ikCMa_extTHead",
|
|
1209
|
-
"extTRow": "_5ikCMa_extTRow",
|
|
1210
|
-
"fetchDialog": "_5ikCMa_fetchDialog",
|
|
1211
|
-
"field": "_5ikCMa_field",
|
|
1212
|
-
"fieldLabel": "_5ikCMa_fieldLabel",
|
|
1213
|
-
"iconButton": "_5ikCMa_iconButton",
|
|
1214
|
-
"iconButtonDanger": "_5ikCMa_iconButtonDanger",
|
|
1215
|
-
"input": "_5ikCMa_input",
|
|
1216
|
-
"intro": "_5ikCMa_intro",
|
|
1217
|
-
"linkButton": "_5ikCMa_linkButton",
|
|
1218
|
-
"modal": "_5ikCMa_modal",
|
|
1219
|
-
"modalDesc": "_5ikCMa_modalDesc",
|
|
1220
|
-
"modalFoot": "_5ikCMa_modalFoot",
|
|
1221
|
-
"modalMask": "_5ikCMa_modalMask",
|
|
1222
|
-
"modalTitle": "_5ikCMa_modalTitle",
|
|
1223
|
-
"modelAdvanced": "_5ikCMa_modelAdvanced",
|
|
1224
|
-
"modelCatalog": "_5ikCMa_modelCatalog",
|
|
1225
|
-
"modelCatalogHeading": "_5ikCMa_modelCatalogHeading",
|
|
1226
|
-
"modelCatalogMeta": "_5ikCMa_modelCatalogMeta",
|
|
1227
|
-
"modelCatalogTitle": "_5ikCMa_modelCatalogTitle",
|
|
1228
|
-
"modelDropLine": "_5ikCMa_modelDropLine",
|
|
1229
|
-
"modelEmpty": "_5ikCMa_modelEmpty",
|
|
1230
|
-
"modelEntry": "_5ikCMa_modelEntry",
|
|
1231
|
-
"modelEntryDragging": "_5ikCMa_modelEntryDragging",
|
|
1232
|
-
"modelField": "_5ikCMa_modelField",
|
|
1233
|
-
"modelFieldLabel": "_5ikCMa_modelFieldLabel",
|
|
1234
|
-
"modelList": "_5ikCMa_modelList",
|
|
1235
|
-
"modelListHead": "_5ikCMa_modelListHead",
|
|
1236
|
-
"modelRow": "_5ikCMa_modelRow",
|
|
1237
|
-
"primaryButton": "_5ikCMa_primaryButton",
|
|
1238
|
-
"quickEmpty": "_5ikCMa_quickEmpty",
|
|
1239
|
-
"quickItem": "_5ikCMa_quickItem",
|
|
1240
|
-
"quickItemApi": "_5ikCMa_quickItemApi",
|
|
1241
|
-
"quickItemId": "_5ikCMa_quickItemId",
|
|
1242
|
-
"quickList": "_5ikCMa_quickList",
|
|
1243
|
-
"quickWrap": "_5ikCMa_quickWrap",
|
|
1244
|
-
"rowActions": "_5ikCMa_rowActions",
|
|
1245
|
-
"rowCard": "_5ikCMa_rowCard",
|
|
1246
|
-
"rowHead": "_5ikCMa_rowHead",
|
|
1247
|
-
"rowIdentity": "_5ikCMa_rowIdentity",
|
|
1248
|
-
"rowName": "_5ikCMa_rowName",
|
|
1249
|
-
"rows": "_5ikCMa_rows",
|
|
1250
|
-
"rowTag": "_5ikCMa_rowTag",
|
|
1251
|
-
"savedNotice": "_5ikCMa_savedNotice",
|
|
1252
|
-
"secondaryButton": "_5ikCMa_secondaryButton",
|
|
1253
|
-
"section": "_5ikCMa_section",
|
|
1254
|
-
"selectInput": "_5ikCMa_selectInput",
|
|
1255
|
-
"setupCard": "_5ikCMa_setupCard",
|
|
1256
|
-
"switchRow": "_5ikCMa_switchRow",
|
|
1257
|
-
"tabBar": "_5ikCMa_tabBar",
|
|
1258
|
-
"tabButton": "_5ikCMa_tabButton",
|
|
1259
|
-
"tabButtonActive": "_5ikCMa_tabButtonActive",
|
|
1260
|
-
"tabPanel": "_5ikCMa_tabPanel",
|
|
1261
|
-
"tabs": "_5ikCMa_tabs",
|
|
1262
|
-
"title": "_5ikCMa_title",
|
|
1263
|
-
"titleRow": "_5ikCMa_titleRow"
|
|
1264
|
-
};
|
|
1265
|
-
//#endregion
|
|
1266
1430
|
//#region src/client/models-plus/QuickLoad.tsx
|
|
1267
1431
|
/**
|
|
1268
1432
|
* Quick-load: source → provider → model id, three narrowing steps.
|
|
@@ -1788,8 +1952,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
1788
1952
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1789
1953
|
className: models_plus_module_default["extGroup"],
|
|
1790
1954
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1791
|
-
className: models_plus_module_default["
|
|
1792
|
-
style: { padding: "0 4px" },
|
|
1955
|
+
className: models_plus_module_default["capacityRow"],
|
|
1793
1956
|
children: [capacityField("contextWindow", "上下文窗口"), capacityField("maxTokens", "最大输出 token")]
|
|
1794
1957
|
})
|
|
1795
1958
|
}),
|
|
@@ -2553,6 +2716,56 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2553
2716
|
return typeof named === "string" && named.length > 0 ? named : deriveKeyRef(provider);
|
|
2554
2717
|
}
|
|
2555
2718
|
/**
|
|
2719
|
+
* Judge the credential field the way the official card does: a profile's named
|
|
2720
|
+
* reference decides alone, the directory's native variables stand in only when
|
|
2721
|
+
* the profile names none, endpoint variables are not credentials, and oauth
|
|
2722
|
+
* references stay out of the display without changing what the adapter reads.
|
|
2723
|
+
*
|
|
2724
|
+
* Kept free of the translation table so the judgement can be asserted directly.
|
|
2725
|
+
* @param input - resolved profile facts plus the batch described credential state.
|
|
2726
|
+
* @returns the copy keys and state facts the field renders from.
|
|
2727
|
+
*/
|
|
2728
|
+
function credentialView(input) {
|
|
2729
|
+
const native = input.namedRef === void 0 ? input.nativeAuth : void 0;
|
|
2730
|
+
const authRefs = input.namedRef === void 0 ? (native?.env ?? []).filter((ref) => !input.baseURLEnv.includes(ref)) : [input.namedRef];
|
|
2731
|
+
const visibleRefs = authRefs.filter((ref) => !ref.toLowerCase().includes("oauth"));
|
|
2732
|
+
const keyHint = visibleRefs[0];
|
|
2733
|
+
const checked = authRefs.map((ref) => [ref, input.credentialChecks?.[ref] ?? (ref === input.namedRef ? input.credential : void 0)]);
|
|
2734
|
+
const detected = checked.find(([, info]) => info?.configured === true);
|
|
2735
|
+
const detectedRef = detected?.[0];
|
|
2736
|
+
const detectedVisible = detectedRef !== void 0 && visibleRefs.includes(detectedRef) ? detectedRef : void 0;
|
|
2737
|
+
const missingRefs = checked.length > 0 && checked.every(([, info]) => info?.configured === false);
|
|
2738
|
+
const savedCredential = detected?.[1]?.source === "file";
|
|
2739
|
+
const locked = input.credential?.writable === false;
|
|
2740
|
+
const hint = locked || input.keyDraft.length > 0 || savedCredential || keyHint === void 0 ? void 0 : detectedRef === void 0 ? missingRefs ? {
|
|
2741
|
+
key: "keyFallbackMissing",
|
|
2742
|
+
tone: "notice"
|
|
2743
|
+
} : {
|
|
2744
|
+
key: "keyFallbackUnchecked",
|
|
2745
|
+
tone: "advancedHint"
|
|
2746
|
+
} : detectedVisible === void 0 ? {
|
|
2747
|
+
key: "keyFallbackDetectedHidden",
|
|
2748
|
+
tone: "advancedHint"
|
|
2749
|
+
} : {
|
|
2750
|
+
key: "keyFallbackDetected",
|
|
2751
|
+
tone: "savedNotice"
|
|
2752
|
+
};
|
|
2753
|
+
return {
|
|
2754
|
+
visibleRefs,
|
|
2755
|
+
keyHint,
|
|
2756
|
+
placeholderKey: locked ? "keyEnvLocked" : keyHint === void 0 ? "keyPlaceholder" : savedCredential ? "keyPlaceholderSaved" : "keyPlaceholderFallback",
|
|
2757
|
+
placeholderHint: keyHint,
|
|
2758
|
+
...hint === void 0 ? {} : {
|
|
2759
|
+
hintKey: hint.key,
|
|
2760
|
+
hintRef: detectedVisible ?? keyHint,
|
|
2761
|
+
hintTone: hint.tone
|
|
2762
|
+
},
|
|
2763
|
+
...visibleRefs.length === 0 ? {} : { helpRefs: visibleRefs },
|
|
2764
|
+
keyless: native !== void 0 && native.env.length === 0 && native.oauth,
|
|
2765
|
+
locked
|
|
2766
|
+
};
|
|
2767
|
+
}
|
|
2768
|
+
/**
|
|
2556
2769
|
* Render one existing provider's editing card.
|
|
2557
2770
|
* @param props - the addressed profile plus wire faces.
|
|
2558
2771
|
* @returns the editor card.
|
|
@@ -2562,7 +2775,6 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2562
2775
|
const [draft, setDraft] = (0, react.useState)(() => draftAt(schema, namespace, settingsPath));
|
|
2563
2776
|
const [tab, setTab] = (0, react.useState)("provider");
|
|
2564
2777
|
const [keyDraft, setKeyDraft] = (0, react.useState)("");
|
|
2565
|
-
const [keyState, setKeyState] = (0, react.useState)(void 0);
|
|
2566
2778
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
2567
2779
|
const [failure, setFailure] = (0, react.useState)(void 0);
|
|
2568
2780
|
const [committedOriginal, setCommittedOriginal] = (0, react.useState)(() => schema.getPath(namespace.user, settingsPath));
|
|
@@ -2599,22 +2811,6 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2599
2811
|
stale = true;
|
|
2600
2812
|
};
|
|
2601
2813
|
}, [layout]);
|
|
2602
|
-
(0, react.useEffect)(() => {
|
|
2603
|
-
if (accountProvider) return;
|
|
2604
|
-
let stale = false;
|
|
2605
|
-
setKeyState(void 0);
|
|
2606
|
-
operations.describeCredential(keyRef).then((described) => {
|
|
2607
|
-
if (stale) return;
|
|
2608
|
-
setKeyState(described);
|
|
2609
|
-
});
|
|
2610
|
-
return () => {
|
|
2611
|
-
stale = true;
|
|
2612
|
-
};
|
|
2613
|
-
}, [
|
|
2614
|
-
operations,
|
|
2615
|
-
keyRef,
|
|
2616
|
-
accountProvider
|
|
2617
|
-
]);
|
|
2618
2814
|
const stringAt = (source, key) => {
|
|
2619
2815
|
const value = schema.getPath(source, [key]);
|
|
2620
2816
|
return typeof value === "string" && value.trim().length > 0 ? value : void 0;
|
|
@@ -2634,7 +2830,13 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2634
2830
|
* from; without it a row can carry switches the route will refuse.
|
|
2635
2831
|
*/
|
|
2636
2832
|
const routeApi = layout === "pi-ai" ? (props.declared === true ? stringAt(draft, "api") ?? stringAt(fallback, "api") : void 0) ?? sharedCatalogApi(prefillIndex, props.provider) : void 0;
|
|
2637
|
-
|
|
2833
|
+
/** One positioned, localised sentence for any model-row refusal. */
|
|
2834
|
+
const describeModelFailure = (failure) => {
|
|
2835
|
+
if (failure.key === "modelCompatNotOffered") return compatFailureMessage(failure);
|
|
2836
|
+
const copy = failure.key === "modelReasoningValueRequired" ? "reasoningEffortEmptyWire" : failure.key === "modelReasoningNeedsLevel" ? "reasoningEffortsNeedNonOff" : failure.key;
|
|
2837
|
+
return `模型 ${String(failure.index + 1)}:${props.t(copy)}`;
|
|
2838
|
+
};
|
|
2839
|
+
const modelFailure = validateModelRows(schema.getPath(draft, ["models"]), routeApi) ?? (layout === "pi-ai" ? validateReasoningEfforts(schema.getPath(draft, ["models"])) : void 0);
|
|
2638
2840
|
const keyFailure = (() => {
|
|
2639
2841
|
if (keyDraft.length === 0) return void 0;
|
|
2640
2842
|
const value = keyDraft.trim();
|
|
@@ -2662,14 +2864,8 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2662
2864
|
const applyOnce = async () => {
|
|
2663
2865
|
const ns = namespace.ns;
|
|
2664
2866
|
let next = layout === "pi-ai" && stringAt(draft, "apiKeyEnv") === void 0 && stringAt(fallback, "apiKeyEnv") === void 0 && keyValue.length > 0 ? schema.setPath(draft, ["apiKeyEnv"], keyRef) : draft;
|
|
2665
|
-
const rowFailure = validateModelRows(schema.getPath(next, ["models"]), routeApi);
|
|
2666
|
-
if (rowFailure !== void 0) return
|
|
2667
|
-
modelIdRequired: "模型 ID 不能为空。",
|
|
2668
|
-
modelIdDuplicate: "模型 ID 不能重复。",
|
|
2669
|
-
modelNameInvalid: "显示名称不能为空。",
|
|
2670
|
-
modelContextInvalid: "上下文窗口须为正数,如 131072、256K、1M。",
|
|
2671
|
-
modelMaxTokensInvalid: "最大输出 token 数须为正数,如 8192、64K、1M。"
|
|
2672
|
-
}[rowFailure.key]}`;
|
|
2867
|
+
const rowFailure = validateModelRows(schema.getPath(next, ["models"]), routeApi) ?? (layout === "pi-ai" ? validateReasoningEfforts(schema.getPath(next, ["models"])) : void 0);
|
|
2868
|
+
if (rowFailure !== void 0) return describeModelFailure(rowFailure);
|
|
2673
2869
|
if (node !== void 0 && settingsPath.length === 0) {
|
|
2674
2870
|
const sectionError = schema.validate(node, next);
|
|
2675
2871
|
if (sectionError !== void 0) return sectionError;
|
|
@@ -2724,8 +2920,35 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2724
2920
|
const models = modelDrafts(modelsOverridden ? customModels : inheritedModels());
|
|
2725
2921
|
const defaultContextWindow = schema.getPath(fallback, ["defaultContextWindow"]);
|
|
2726
2922
|
const defaultMaxTokens = schema.getPath(fallback, ["maxTokens"]);
|
|
2727
|
-
const
|
|
2728
|
-
|
|
2923
|
+
const view = credentialView({
|
|
2924
|
+
namedRef: stringAt(fallback, "apiKeyEnv"),
|
|
2925
|
+
nativeAuth: props.nativeAuth,
|
|
2926
|
+
baseURLEnv: props.baseURLEnv ?? [],
|
|
2927
|
+
keyDraft,
|
|
2928
|
+
credential: props.credential,
|
|
2929
|
+
credentialChecks: props.credentialChecks
|
|
2930
|
+
});
|
|
2931
|
+
const keyLocked = view.locked;
|
|
2932
|
+
const credentialHint = view.hintKey === void 0 ? void 0 : props.t(view.hintKey).replace("{hint}", () => view.hintRef ?? "");
|
|
2933
|
+
const keyHelp = view.helpRefs === void 0 ? void 0 : props.t("keyHelp").replace("{env}", () => (view.helpRefs ?? []).join(" / "));
|
|
2934
|
+
const authHelp = keyHelp === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
|
|
2935
|
+
label: keyHelp,
|
|
2936
|
+
side: "right",
|
|
2937
|
+
delayMs: 0,
|
|
2938
|
+
focusDelayMs: 0,
|
|
2939
|
+
portal: true,
|
|
2940
|
+
openOnClick: true,
|
|
2941
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2942
|
+
type: "button",
|
|
2943
|
+
className: models_plus_module_default["helpButton"],
|
|
2944
|
+
"aria-label": props.t("authHelp"),
|
|
2945
|
+
children: "?"
|
|
2946
|
+
})
|
|
2947
|
+
});
|
|
2948
|
+
const keyPlaceholder = props.t(view.placeholderKey).replace("{hint}", () => view.placeholderHint ?? "");
|
|
2949
|
+
const baseURL = stringAt(fallback, "baseURL") ?? props.defaultBaseURL;
|
|
2950
|
+
const endpointEnv = props.baseURLEnv ?? [];
|
|
2951
|
+
const endpointHint = layout === "deepseek" ? "该路由固定使用 Messages 协议,地址须指向兼容该协议的端点。" : baseURL === void 0 && endpointEnv.length > 0 ? props.t("baseUrlEnvironment").replace("{env}", () => endpointEnv.join(", ")) : void 0;
|
|
2729
2952
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2730
2953
|
className: models_plus_module_default["editor"],
|
|
2731
2954
|
children: [
|
|
@@ -2736,23 +2959,9 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2736
2959
|
namespace.ns,
|
|
2737
2960
|
")"
|
|
2738
2961
|
]
|
|
2739
|
-
}) : accountProvider ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
routeApi,
|
|
2743
|
-
defaultContextWindow: typeof defaultContextWindow === "number" ? defaultContextWindow : void 0,
|
|
2744
|
-
defaultMaxTokens: typeof defaultMaxTokens === "number" ? defaultMaxTokens : void 0,
|
|
2745
|
-
probe,
|
|
2746
|
-
probeBlocked: keyFailure,
|
|
2747
|
-
hideFetch: true,
|
|
2748
|
-
operations,
|
|
2749
|
-
disabled,
|
|
2750
|
-
onChange: (rows) => {
|
|
2751
|
-
setDraft((current) => schema.setPath(current, ["models"], rows));
|
|
2752
|
-
},
|
|
2753
|
-
onReset: () => {
|
|
2754
|
-
setDraft((current) => schema.deletePath(current, ["models"]));
|
|
2755
|
-
}
|
|
2962
|
+
}) : accountProvider ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2963
|
+
className: models_plus_module_default["advancedHint"],
|
|
2964
|
+
children: props.t("accountReadOnly")
|
|
2756
2965
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2757
2966
|
className: models_plus_module_default["tabs"],
|
|
2758
2967
|
children: [
|
|
@@ -2802,28 +3011,33 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2802
3011
|
}
|
|
2803
3012
|
})]
|
|
2804
3013
|
}) : null,
|
|
2805
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3014
|
+
view.keyless ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2806
3015
|
className: models_plus_module_default["field"],
|
|
2807
3016
|
children: [
|
|
2808
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
3017
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2809
3018
|
className: models_plus_module_default["fieldLabel"],
|
|
2810
|
-
children: "
|
|
3019
|
+
children: [props.t("keyInput"), authHelp]
|
|
2811
3020
|
}),
|
|
2812
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2813
|
-
|
|
2814
|
-
type: "password",
|
|
2815
|
-
autoComplete: "off",
|
|
3021
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiKeyInput, {
|
|
3022
|
+
t: props.t,
|
|
2816
3023
|
value: keyDraft,
|
|
2817
3024
|
placeholder: keyPlaceholder,
|
|
2818
|
-
"aria-label": "
|
|
3025
|
+
"aria-label": props.t("keyInput"),
|
|
3026
|
+
"aria-invalid": keyFailure !== void 0,
|
|
3027
|
+
"aria-describedby": credentialHint === void 0 ? void 0 : `${props.provider}-credential-hint`,
|
|
2819
3028
|
disabled: disabled || keyLocked,
|
|
2820
3029
|
onChange: (event) => {
|
|
2821
3030
|
setKeyDraft(event.target.value);
|
|
2822
3031
|
}
|
|
2823
3032
|
}),
|
|
3033
|
+
credentialHint === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3034
|
+
id: `${props.provider}-credential-hint`,
|
|
3035
|
+
className: models_plus_module_default[view.hintTone ?? "advancedHint"],
|
|
3036
|
+
children: credentialHint
|
|
3037
|
+
}),
|
|
2824
3038
|
keyFailure === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2825
3039
|
className: models_plus_module_default["error"],
|
|
2826
|
-
children: keyFailure
|
|
3040
|
+
children: props.t(keyFailure)
|
|
2827
3041
|
})
|
|
2828
3042
|
]
|
|
2829
3043
|
}),
|
|
@@ -2838,17 +3052,19 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2838
3052
|
className: models_plus_module_default["input"],
|
|
2839
3053
|
type: "text",
|
|
2840
3054
|
value: stringAt(draft, "baseURL") ?? "",
|
|
2841
|
-
placeholder: layout === "deepseek" ? DEEPSEEK_BASE_URL :
|
|
3055
|
+
placeholder: layout === "deepseek" ? DEEPSEEK_BASE_URL : baseURL === void 0 ? props.t(endpointEnv.length > 0 ? "baseUrlConfigured" : "baseUrlDefault") : props.t("baseUrlPlaceholder").replace("{url}", () => baseURL),
|
|
3056
|
+
"aria-describedby": endpointHint === void 0 ? void 0 : `${props.provider}-endpoint-hint`,
|
|
2842
3057
|
"aria-label": "API 地址",
|
|
2843
3058
|
disabled,
|
|
2844
3059
|
onChange: (event) => {
|
|
2845
3060
|
setField("baseURL", event.target.value === "" ? void 0 : event.target.value);
|
|
2846
3061
|
}
|
|
2847
3062
|
}),
|
|
2848
|
-
|
|
3063
|
+
endpointHint === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3064
|
+
id: `${props.provider}-endpoint-hint`,
|
|
2849
3065
|
className: models_plus_module_default["advancedHint"],
|
|
2850
|
-
children:
|
|
2851
|
-
})
|
|
3066
|
+
children: endpointHint
|
|
3067
|
+
})
|
|
2852
3068
|
]
|
|
2853
3069
|
}),
|
|
2854
3070
|
layout === "pi-ai" && props.declared === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -2906,7 +3122,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2906
3122
|
}) : null,
|
|
2907
3123
|
modelFailure === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2908
3124
|
className: models_plus_module_default["advancedHint"],
|
|
2909
|
-
children:
|
|
3125
|
+
children: describeModelFailure(modelFailure)
|
|
2910
3126
|
}),
|
|
2911
3127
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2912
3128
|
className: models_plus_module_default["editorActions"],
|
|
@@ -2970,7 +3186,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2970
3186
|
const profileDisabled = disabled || committed;
|
|
2971
3187
|
const routeInvalid = route.length > 0 && !ROUTE_PATTERN.test(route);
|
|
2972
3188
|
const routeTaken = taken.includes(route);
|
|
2973
|
-
const modelFailure = validateModelRows(models, protocol);
|
|
3189
|
+
const modelFailure = validateModelRows(models, protocol) ?? validateReasoningEfforts(models);
|
|
2974
3190
|
const keyFailure = (() => {
|
|
2975
3191
|
if (keyDraft.length === 0) return void 0;
|
|
2976
3192
|
const value = keyDraft.trim();
|
|
@@ -2982,7 +3198,13 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
2982
3198
|
})();
|
|
2983
3199
|
const keyValue = keyDraft.trim();
|
|
2984
3200
|
const ready = route.length > 0 && !routeInvalid && !routeTaken && baseURL.length > 0 && models.length > 0 && modelFailure === void 0 && keyFailure === void 0;
|
|
2985
|
-
const
|
|
3201
|
+
const modelFailureText = (() => {
|
|
3202
|
+
if (modelFailure === void 0) return void 0;
|
|
3203
|
+
if (modelFailure.key === "modelCompatNotOffered") return compatFailureMessage(modelFailure);
|
|
3204
|
+
const copy = modelFailure.key === "modelReasoningValueRequired" ? "reasoningEffortEmptyWire" : modelFailure.key === "modelReasoningNeedsLevel" ? "reasoningEffortsNeedNonOff" : modelFailure.key;
|
|
3205
|
+
return `模型 ${String(modelFailure.index + 1)}:${props.t(copy)}`;
|
|
3206
|
+
})();
|
|
3207
|
+
const hint = failure !== void 0 || ready || keyFailure !== void 0 || route.length === 0 || routeInvalid || routeTaken ? void 0 : baseURL.length === 0 ? "自定义提供方需要填写 API 地址。" : modelFailureText !== void 0 ? modelFailureText : "自定义提供方至少需要一个模型。";
|
|
2986
3208
|
/** Perform the create, returning a failure message or undefined. */
|
|
2987
3209
|
const createOnce = async () => {
|
|
2988
3210
|
const keyRef = deriveKeyRef(route);
|
|
@@ -3143,17 +3365,16 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3143
3365
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3144
3366
|
className: models_plus_module_default["field"],
|
|
3145
3367
|
children: [
|
|
3146
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
3368
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3147
3369
|
className: models_plus_module_default["fieldLabel"],
|
|
3148
|
-
children: "
|
|
3370
|
+
children: props.t("keyInput")
|
|
3149
3371
|
}),
|
|
3150
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
3151
|
-
|
|
3152
|
-
type: "password",
|
|
3153
|
-
autoComplete: "off",
|
|
3372
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiKeyInput, {
|
|
3373
|
+
t: props.t,
|
|
3154
3374
|
value: keyDraft,
|
|
3155
|
-
placeholder: "
|
|
3156
|
-
"aria-label": "
|
|
3375
|
+
placeholder: props.t("keyPlaceholder"),
|
|
3376
|
+
"aria-label": props.t("keyInput"),
|
|
3377
|
+
"aria-invalid": keyFailure !== void 0,
|
|
3157
3378
|
disabled,
|
|
3158
3379
|
onChange: (event) => {
|
|
3159
3380
|
setKeyDraft(event.target.value);
|
|
@@ -3161,7 +3382,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3161
3382
|
}),
|
|
3162
3383
|
keyFailure === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3163
3384
|
className: models_plus_module_default["error"],
|
|
3164
|
-
children: keyFailure === "keyBlank" ? "
|
|
3385
|
+
children: props.t(keyFailure === "keyBlank" ? "keyBlankNew" : "keyIllegalCharacters")
|
|
3165
3386
|
})
|
|
3166
3387
|
]
|
|
3167
3388
|
})
|
|
@@ -3183,7 +3404,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3183
3404
|
api: protocol,
|
|
3184
3405
|
...keyValue.length === 0 ? {} : { apiKey: keyValue }
|
|
3185
3406
|
},
|
|
3186
|
-
probeBlocked: keyFailure === "keyBlank" ? "
|
|
3407
|
+
probeBlocked: keyFailure === void 0 ? void 0 : props.t(keyFailure === "keyBlank" ? "keyBlankNew" : "keyIllegalCharacters"),
|
|
3187
3408
|
operations,
|
|
3188
3409
|
disabled: profileDisabled,
|
|
3189
3410
|
onChange: setModels
|
|
@@ -3246,7 +3467,10 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3246
3467
|
settingsNs: row.entry.settingsNs,
|
|
3247
3468
|
settingsPath: row.entry.settingsPath,
|
|
3248
3469
|
...credentialRef === void 0 ? {} : { credentialRef },
|
|
3249
|
-
...row.entry.declared === true ? { declared: true } : {}
|
|
3470
|
+
...row.entry.declared === true ? { declared: true } : {},
|
|
3471
|
+
...row.entry.defaultBaseURL === void 0 ? {} : { defaultBaseURL: row.entry.defaultBaseURL },
|
|
3472
|
+
...row.entry.baseURLEnv === void 0 ? {} : { baseURLEnv: row.entry.baseURLEnv },
|
|
3473
|
+
...row.entry.nativeAuth === void 0 ? {} : { nativeAuth: row.entry.nativeAuth }
|
|
3250
3474
|
};
|
|
3251
3475
|
}
|
|
3252
3476
|
/**
|
|
@@ -3370,19 +3594,27 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3370
3594
|
const addable = configurable.filter((row) => !row.configured);
|
|
3371
3595
|
const addTarget = adding ? editing : void 0;
|
|
3372
3596
|
const addNamespace = addTarget === void 0 ? void 0 : state.namespaces.get(addTarget.settingsNs);
|
|
3597
|
+
const addRow = addTarget === void 0 ? void 0 : state.rows.find((row) => row.entry.provider === addTarget.provider);
|
|
3373
3598
|
const protocols = (() => {
|
|
3374
3599
|
return protocolChoices(state.namespaces.get("llm-pi-ai"), schema);
|
|
3375
3600
|
})();
|
|
3376
3601
|
const renderEditor = (target, namespace, onClose) => {
|
|
3377
3602
|
if (namespace === void 0) return null;
|
|
3603
|
+
const row = state.rows.find((candidate) => candidate.entry.provider === target.provider);
|
|
3378
3604
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderEditor, {
|
|
3379
3605
|
provider: target.provider,
|
|
3380
3606
|
displayName: target.displayName,
|
|
3381
3607
|
settingsPath: target.settingsPath,
|
|
3382
3608
|
...target.declared === true ? { declared: true } : {},
|
|
3609
|
+
...target.defaultBaseURL === void 0 ? {} : { defaultBaseURL: target.defaultBaseURL },
|
|
3610
|
+
...target.baseURLEnv === void 0 ? {} : { baseURLEnv: target.baseURLEnv },
|
|
3611
|
+
...target.nativeAuth === void 0 ? {} : { nativeAuth: target.nativeAuth },
|
|
3612
|
+
...row?.credential === void 0 ? {} : { credential: row.credential },
|
|
3613
|
+
...row?.credentialChecks === void 0 ? {} : { credentialChecks: row.credentialChecks },
|
|
3383
3614
|
namespace,
|
|
3384
3615
|
schema,
|
|
3385
3616
|
operations,
|
|
3617
|
+
t,
|
|
3386
3618
|
readOnly: !state.writable,
|
|
3387
3619
|
onClose
|
|
3388
3620
|
});
|
|
@@ -3460,6 +3692,13 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3460
3692
|
className: models_plus_module_default["rowTag"],
|
|
3461
3693
|
children: "自定义"
|
|
3462
3694
|
}) : null,
|
|
3695
|
+
row.entry.provider === "deepseek-account" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3696
|
+
className: models_plus_module_default["accountStatus"],
|
|
3697
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3698
|
+
className: `${models_plus_module_default["credentialDot"]} ${models_plus_module_default["credentialDotConfigured"]}`,
|
|
3699
|
+
"aria-hidden": "true"
|
|
3700
|
+
}), t("accountSignedIn")]
|
|
3701
|
+
}) : null,
|
|
3463
3702
|
credentialConfigured ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3464
3703
|
className: `${models_plus_module_default["credentialDot"]} ${models_plus_module_default["credentialDotConfigured"]}`,
|
|
3465
3704
|
role: "img",
|
|
@@ -3474,11 +3713,13 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3474
3713
|
]
|
|
3475
3714
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3476
3715
|
className: models_plus_module_default["rowActions"],
|
|
3477
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3716
|
+
children: [row.entry.provider === "deepseek-account" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
3478
3717
|
type: "button",
|
|
3479
3718
|
className: models_plus_module_default["secondaryButton"],
|
|
3480
3719
|
"aria-label": providerCopy("编辑 {provider}", target),
|
|
3720
|
+
disabled: !open && state.status !== "ready",
|
|
3481
3721
|
onClick: () => {
|
|
3722
|
+
if (!open && state.status !== "ready") return;
|
|
3482
3723
|
setSavedTarget(void 0);
|
|
3483
3724
|
setDeclaring(false);
|
|
3484
3725
|
setAdding(false);
|
|
@@ -3489,8 +3730,9 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3489
3730
|
type: "button",
|
|
3490
3731
|
className: models_plus_module_default["dangerButton"],
|
|
3491
3732
|
"aria-label": providerCopy("删除 {provider}", target),
|
|
3492
|
-
disabled: !state.writable,
|
|
3733
|
+
disabled: !state.writable || state.status !== "ready",
|
|
3493
3734
|
onClick: () => {
|
|
3735
|
+
if (state.status !== "ready") return;
|
|
3494
3736
|
setSavedTarget(void 0);
|
|
3495
3737
|
setDeleteFailure(void 0);
|
|
3496
3738
|
setDeleteTarget(target);
|
|
@@ -3532,10 +3774,16 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3532
3774
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProviderEditor, {
|
|
3533
3775
|
provider: addTarget.provider,
|
|
3534
3776
|
displayName: addTarget.displayName,
|
|
3777
|
+
...addRow?.credential === void 0 ? {} : { credential: addRow.credential },
|
|
3778
|
+
...addRow?.credentialChecks === void 0 ? {} : { credentialChecks: addRow.credentialChecks },
|
|
3779
|
+
...addTarget.defaultBaseURL === void 0 ? {} : { defaultBaseURL: addTarget.defaultBaseURL },
|
|
3780
|
+
...addTarget.baseURLEnv === void 0 ? {} : { baseURLEnv: addTarget.baseURLEnv },
|
|
3781
|
+
...addTarget.nativeAuth === void 0 ? {} : { nativeAuth: addTarget.nativeAuth },
|
|
3535
3782
|
namespace: addNamespace,
|
|
3536
3783
|
schema,
|
|
3537
3784
|
settingsPath: addTarget.settingsPath,
|
|
3538
3785
|
operations,
|
|
3786
|
+
t,
|
|
3539
3787
|
readOnly: !state.writable,
|
|
3540
3788
|
onClose: (changed) => {
|
|
3541
3789
|
closeEditor(changed, addTarget);
|
|
@@ -3548,6 +3796,7 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3548
3796
|
protocols,
|
|
3549
3797
|
revision: state.namespaces.get("llm-pi-ai")?.revision ?? 0,
|
|
3550
3798
|
operations,
|
|
3799
|
+
t,
|
|
3551
3800
|
readOnly: !state.writable,
|
|
3552
3801
|
onClose: (changed) => {
|
|
3553
3802
|
setDeclaring(false);
|
|
@@ -3559,8 +3808,9 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3559
3808
|
children: [configurable.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3560
3809
|
type: "button",
|
|
3561
3810
|
className: models_plus_module_default["addButton"],
|
|
3562
|
-
disabled: addable.length === 0 || !state.writable,
|
|
3811
|
+
disabled: addable.length === 0 || !state.writable || state.status !== "ready",
|
|
3563
3812
|
onClick: () => {
|
|
3813
|
+
if (state.status !== "ready") return;
|
|
3564
3814
|
const first = addable[0];
|
|
3565
3815
|
if (first === void 0) return;
|
|
3566
3816
|
setSavedTarget(void 0);
|
|
@@ -3584,8 +3834,9 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3584
3834
|
}), state.namespaces.has("llm-pi-ai") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3585
3835
|
type: "button",
|
|
3586
3836
|
className: models_plus_module_default["addButton"],
|
|
3587
|
-
disabled: protocols.length === 0 || !state.writable,
|
|
3837
|
+
disabled: protocols.length === 0 || !state.writable || state.status !== "ready",
|
|
3588
3838
|
onClick: () => {
|
|
3839
|
+
if (state.status !== "ready") return;
|
|
3589
3840
|
setSavedTarget(void 0);
|
|
3590
3841
|
setAdding(false);
|
|
3591
3842
|
setEditing(void 0);
|
|
@@ -3665,10 +3916,6 @@ if (typeof document !== 'undefined' && document.querySelector('style[data-plugin
|
|
|
3665
3916
|
*/
|
|
3666
3917
|
function createModelsOperations(ctx) {
|
|
3667
3918
|
return {
|
|
3668
|
-
describeCredential: async (ref) => {
|
|
3669
|
-
const response = await ctx.remote.credentials.describe([ref]);
|
|
3670
|
-
return response.ok ? response.value[ref] : void 0;
|
|
3671
|
-
},
|
|
3672
3919
|
storeCredential: async (ref, value) => {
|
|
3673
3920
|
const response = await ctx.remote.credentials.set(ref, value);
|
|
3674
3921
|
return response.ok ? void 0 : response.error.message;
|