fix: reverse setting local provider (#5140)

* fix: reverse setting local provider

* fix conflict
This commit is contained in:
Faisal Amir 2025-05-30 00:00:07 +07:00 committed by GitHub
parent e9c9205544
commit 27c2a360f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -240,6 +240,14 @@ function ProviderDetail() {
/>
</div>
<div
className={cn(
'flex flex-col gap-3',
provider &&
provider.provider === 'llama.cpp' &&
'flex-col-reverse'
)}
>
{/* Settings */}
<Card>
{provider?.settings.map((setting, settingIndex) => {
@ -369,7 +377,9 @@ function ProviderDetail() {
/>
)}
<span className="text-main-view-fg/70">
{refreshingModels ? 'Refreshing...' : 'Refresh'}
{refreshingModels
? 'Refreshing...'
: 'Refresh'}
</span>
</div>
</Button>
@ -397,7 +407,10 @@ function ProviderDetail() {
try {
await importModel(selectedFile)
} catch (error) {
console.error('Failed to import model:', error)
console.error(
'Failed to import model:',
error
)
} finally {
// Refresh the provider to update the models list
getProviders().then(setProviders)
@ -409,12 +422,14 @@ function ProviderDetail() {
}
}}
>
<div className="cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-1.5 py-1 gap-1">
<div className="cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out p-1.5 py-1 gap-1 -mr-2">
<IconFolderPlus
size={18}
className="text-main-view-fg/50"
/>
<span className="text-main-view-fg/70">Import</span>
<span className="text-main-view-fg/70">
Import
</span>
</div>
</Button>
)}
@ -436,23 +451,45 @@ function ProviderDetail() {
}
actions={
<div className="flex items-center gap-1">
{provider && provider.provider === 'llama.cpp' && (
<div className="mr-1">
<DialogEditModel
provider={provider}
modelId={model.id}
/>
{model.settings && (
<ModelSetting
provider={provider}
model={model}
/>
)}
<DialogDeleteModel
provider={provider}
modelId={model.id}
/>
{provider &&
provider.provider === 'llama.cpp' && (
<div className="ml-2">
{activeModels.some(
(activeModel) => activeModel.id === model.id
(activeModel) =>
activeModel.id === model.id
) ? (
<Button
size="sm"
variant="destructive"
onClick={() => handleStopModel(model.id)}
onClick={() =>
handleStopModel(model.id)
}
>
Stop
</Button>
) : (
<Button
size="sm"
disabled={loadingModels.includes(model.id)}
onClick={() => handleStartModel(model.id)}
disabled={loadingModels.includes(
model.id
)}
onClick={() =>
handleStartModel(model.id)
}
>
{loadingModels.includes(model.id) ? (
<div className="flex items-center gap-2">
@ -468,17 +505,6 @@ function ProviderDetail() {
)}
</div>
)}
<DialogEditModel
provider={provider}
modelId={model.id}
/>
{model.settings && (
<ModelSetting provider={provider} model={model} />
)}
<DialogDeleteModel
provider={provider}
modelId={model.id}
/>
</div>
}
/>
@ -487,7 +513,9 @@ function ProviderDetail() {
) : (
<div className="-mt-2">
<div className="flex items-center gap-2 text-left-panel-fg/80">
<h6 className="font-medium text-base">No model found</h6>
<h6 className="font-medium text-base">
No model found
</h6>
</div>
<p className="text-left-panel-fg/60 mt-1 text-xs leading-relaxed">
Available models will be listed here. If you don't have
@ -502,6 +530,7 @@ function ProviderDetail() {
</div>
</div>
</div>
</div>
</>
)
}