Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: model dropdown icon miss align #4645

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/containers/ModelDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@

const handleChangeStateOpen = useCallback(
(state: boolean) => {
setOpen(state)
setModelDropdownState(state)

Check warning on line 130 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

129-130 lines are not covered with tests
},
[setModelDropdownState]
)
Expand All @@ -137,7 +137,7 @@
configuredModels
.concat(
downloadedModels.filter(
(e) => !configuredModels.some((x) => x.id === e.id)

Check warning on line 140 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

140 line is not covered with tests
)
)
.filter((e) =>
Expand All @@ -146,26 +146,26 @@
.filter((e) => {
if (searchFilter === 'local') {
return (
engineList.find((t) => t.engine?.engine === e.engine)?.type ===

Check warning on line 149 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

149 line is not covered with tests
'local'
)
}
return true

Check warning on line 153 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

153 line is not covered with tests
})
.sort((a, b) => a.name.localeCompare(b.name))

Check warning on line 155 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

155 line is not covered with tests
.sort((a, b) => {
const aInDownloadedModels = downloadedModels.some(
(item) => item.id === a.id

Check warning on line 158 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

157-158 lines are not covered with tests
)
const bInDownloadedModels = downloadedModels.some(
(item) => item.id === b.id

Check warning on line 161 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

160-161 lines are not covered with tests
)
if (aInDownloadedModels && !bInDownloadedModels) {
return -1
} else if (!aInDownloadedModels && bInDownloadedModels) {
return 1

Check warning on line 166 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

163-166 lines are not covered with tests
} else {
return 0

Check warning on line 168 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

168 line is not covered with tests
}
}),
[configuredModels, searchText, searchFilter, downloadedModels, engineList]
Expand All @@ -187,8 +187,8 @@
setShowEngineListModel((prev) => [
...prev,
...engineList
.filter((x) => (x.engine?.api_key?.length ?? 0) > 0)
.map((e) => e.name),

Check warning on line 191 in web/containers/ModelDropdown/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

190-191 lines are not covered with tests
])
}, [setShowEngineListModel, engineList])

Expand Down Expand Up @@ -475,7 +475,7 @@
>
<div className="flex items-center gap-2">
<p
className="line-clamp-1 text-[hsla(var(--text-secondary))]"
className="max-w-[200px] overflow-hidden truncate whitespace-nowrap text-[hsla(var(--text-secondary))]"
title={model.name}
>
{model.name}
Expand Down Expand Up @@ -573,7 +573,7 @@
<div className="flex gap-x-2">
<p
className={twMerge(
'line-clamp-1',
'max-w-[200px] overflow-hidden truncate whitespace-nowrap',
!isDownloaded &&
'text-[hsla(var(--text-secondary))]'
)}
Expand Down
Loading