mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
Merge pull request #6682 from Kilo-Org/jl-remove-allowed-providers
Remove allowed providers setting for now
This commit is contained in:
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ca60d19590a31f4faa5c79c163b0ea24bae70599d0068c17fd475195b602bf4e
|
||||
size 32506
|
||||
oid sha256:353cb9b38c19e5d3bf1c7c6e84a29da3b3365211c425703d7fcdb7e7a2153c74
|
||||
size 22824
|
||||
|
||||
@@ -41,23 +41,21 @@ const ProvidersTab: Component = () => {
|
||||
)
|
||||
|
||||
const [newDisabled, setNewDisabled] = createSignal<ProviderOption | undefined>()
|
||||
const [newEnabled, setNewEnabled] = createSignal<ProviderOption | undefined>()
|
||||
|
||||
const disabledProviders = () => config().disabled_providers ?? []
|
||||
const enabledProviders = () => config().enabled_providers ?? []
|
||||
|
||||
const addToList = (key: "disabled_providers" | "enabled_providers", value: string) => {
|
||||
const current = key === "disabled_providers" ? [...disabledProviders()] : [...enabledProviders()]
|
||||
const addDisabled = (value: string) => {
|
||||
const current = [...disabledProviders()]
|
||||
if (value && !current.includes(value)) {
|
||||
current.push(value)
|
||||
updateConfig({ [key]: current })
|
||||
updateConfig({ disabled_providers: current })
|
||||
}
|
||||
}
|
||||
|
||||
const removeFromList = (key: "disabled_providers" | "enabled_providers", index: number) => {
|
||||
const current = key === "disabled_providers" ? [...disabledProviders()] : [...enabledProviders()]
|
||||
const removeDisabled = (index: number) => {
|
||||
const current = [...disabledProviders()]
|
||||
current.splice(index, 1)
|
||||
updateConfig({ [key]: current })
|
||||
updateConfig({ disabled_providers: current })
|
||||
}
|
||||
|
||||
function handleModelSelect(configKey: "model" | "small_model") {
|
||||
@@ -172,7 +170,7 @@ const ProvidersTab: Component = () => {
|
||||
variant="secondary"
|
||||
onClick={() => {
|
||||
if (newDisabled()) {
|
||||
addToList("disabled_providers", newDisabled()!.value)
|
||||
addDisabled(newDisabled()!.value)
|
||||
setNewDisabled(undefined)
|
||||
}
|
||||
}}
|
||||
@@ -193,71 +191,7 @@ const ProvidersTab: Component = () => {
|
||||
}}
|
||||
>
|
||||
<span style={{ "font-size": "12px" }}>{id}</span>
|
||||
<IconButton variant="ghost" icon="close" onClick={() => removeFromList("disabled_providers", index())} />
|
||||
</div>
|
||||
)}
|
||||
</For>
|
||||
</Card>
|
||||
|
||||
{/* Enabled providers (allowlist) */}
|
||||
<h4 style={{ "margin-top": "16px", "margin-bottom": "8px" }}>{language.t("settings.providers.enabled")}</h4>
|
||||
<Card>
|
||||
<div
|
||||
style={{
|
||||
"font-size": "12px",
|
||||
color: "var(--text-weak-base, var(--vscode-descriptionForeground))",
|
||||
"padding-bottom": "8px",
|
||||
"border-bottom": "1px solid var(--border-weak-base)",
|
||||
}}
|
||||
>
|
||||
{language.t("settings.providers.enabled.description")}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "8px",
|
||||
"align-items": "center",
|
||||
padding: "8px 0",
|
||||
"border-bottom": enabledProviders().length > 0 ? "1px solid var(--border-weak-base)" : "none",
|
||||
}}
|
||||
>
|
||||
<div style={{ flex: 1 }}>
|
||||
<Select
|
||||
options={providerOptions().filter((o) => !enabledProviders().includes(o.value))}
|
||||
current={newEnabled()}
|
||||
value={(o) => o.value}
|
||||
label={(o) => o.label}
|
||||
onSelect={(o) => setNewEnabled(o)}
|
||||
variant="secondary"
|
||||
triggerVariant="settings"
|
||||
placeholder="Select provider…"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => {
|
||||
if (newEnabled()) {
|
||||
addToList("enabled_providers", newEnabled()!.value)
|
||||
setNewEnabled(undefined)
|
||||
}
|
||||
}}
|
||||
>
|
||||
{language.t("common.add")}
|
||||
</Button>
|
||||
</div>
|
||||
<For each={enabledProviders()}>
|
||||
{(id, index) => (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
"align-items": "center",
|
||||
"justify-content": "space-between",
|
||||
padding: "6px 0",
|
||||
"border-bottom": index() < enabledProviders().length - 1 ? "1px solid var(--border-weak-base)" : "none",
|
||||
}}
|
||||
>
|
||||
<span style={{ "font-size": "12px" }}>{id}</span>
|
||||
<IconButton variant="ghost" icon="close" onClick={() => removeFromList("enabled_providers", index())} />
|
||||
<IconButton variant="ghost" icon="close" onClick={() => removeDisabled(index())} />
|
||||
</div>
|
||||
)}
|
||||
</For>
|
||||
|
||||
Reference in New Issue
Block a user