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

enhancement: update responsive setting and my model page #4533

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
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
18 changes: 10 additions & 8 deletions web/screens/Settings/Advanced/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
const selectedGpu = gpuList
.filter((x) => gpusInUse.includes(x.id))
.map((y) => {
return y['name']

Check warning on line 83 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

83 line is not covered with tests
})

/**
Expand All @@ -89,7 +89,7 @@
* there is also a case where state update persist everytime user type in the input
*/
const updatePullOptions = useDebouncedCallback(
() => configurePullOptions(),

Check warning on line 92 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

92 line is not covered with tests
300
)

Expand All @@ -104,10 +104,10 @@
relaunch: boolean = true
) => {
const appConfiguration: AppConfiguration =
await window.core?.api?.getAppConfigurations()
appConfiguration.quick_ask = e
await window.core?.api?.updateAppConfiguration(appConfiguration)
if (relaunch) window.core?.api?.relaunch()

Check warning on line 110 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

107-110 lines are not covered with tests
}

/**
Expand All @@ -117,15 +117,15 @@
* @returns void
*/
const updateVulkanEnabled = async (e: boolean, relaunch: boolean = true) => {
toaster({

Check warning on line 120 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

120 line is not covered with tests
title: 'Reload',
description: 'Vulkan settings updated. Reload now to apply the changes.',
})
stopModel()
setVulkanEnabled(e)
await saveSettings({ vulkan: e, gpusInUse: [] })

Check warning on line 126 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

124-126 lines are not covered with tests
// Relaunch to apply settings
if (relaunch) window.location.reload()

Check warning on line 128 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

128 line is not covered with tests
}

/**
Expand Down Expand Up @@ -171,25 +171,25 @@
* @returns
*/
const handleGPUChange = async (gpuId: string) => {
let updatedGpusInUse = [...gpusInUse]
if (updatedGpusInUse.includes(gpuId)) {
updatedGpusInUse = updatedGpusInUse.filter((id) => id !== gpuId)
if (

Check warning on line 177 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

174-177 lines are not covered with tests
gpuEnabled &&
updatedGpusInUse.length === 0 &&
gpuId &&
gpuId.trim()
) {
// Vulkan support only allow 1 active device at a time
if (vulkanEnabled) {
updatedGpusInUse = []

Check warning on line 185 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

184-185 lines are not covered with tests
}
updatedGpusInUse.push(gpuId)

Check warning on line 187 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

187 line is not covered with tests
}
} else {
// Vulkan support only allow 1 active device at a time
if (vulkanEnabled) {
updatedGpusInUse = []

Check warning on line 192 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

191-192 lines are not covered with tests
}
if (gpuId && gpuId.trim()) updatedGpusInUse.push(gpuId)
}
Expand All @@ -212,8 +212,8 @@
<ScrollArea className="h-full w-full px-4">
<div className="block w-full py-4">
{/* Experimental */}
<div className="flex w-full flex-col items-start justify-between gap-4 border-b border-[hsla(var(--app-border))] py-4 first:pt-0 last:border-none sm:flex-row">
<div className="flex-shrink-0 space-y-1">
<div className="flex w-full flex-row items-start justify-between gap-4 border-b border-[hsla(var(--app-border))] py-4 first:pt-0 last:border-none">
<div className="space-y-1">
<div className="flex gap-x-2">
<h6 className="font-semibold capitalize">Experimental Mode</h6>
</div>
Expand All @@ -222,11 +222,13 @@
performance. Enable with caution.
</p>
</div>
<Switch
data-testid="experimental-switch"
checked={experimentalEnabled}
onChange={updateExperimentalEnabled}
/>
<div className="flex-shrink-0">
<Switch
data-testid="experimental-switch"
checked={experimentalEnabled}
onChange={updateExperimentalEnabled}
/>
</div>
</div>

{/* CPU / GPU switching */}
Expand Down Expand Up @@ -428,7 +430,7 @@

{/* Proxy Settings Link */}
<div className="flex w-full flex-col items-start justify-between gap-4 border-b border-[hsla(var(--app-border))] py-4 first:pt-0 last:border-none sm:flex-row">
<div className="flex w-full cursor-pointer items-center justify-between">
<div className="flex w-full cursor-pointer items-start justify-between">
<div className="space-y-1">
<div className="flex gap-x-2">
<h6 className="font-semibold capitalize">HTTPS Proxy</h6>
Expand Down
2 changes: 1 addition & 1 deletion web/screens/Settings/MyModels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const MyModels = () => {

return (
<div className="my-6" key={i}>
<div className="flex flex-col items-start justify-start gap-2 sm:flex-row sm:items-center sm:justify-between">
<div className="flex flex-row items-center justify-between gap-2">
<div
className="mb-1 mt-3 flex cursor-pointer items-center gap-2"
onClick={onClickChevron}
Expand Down
Loading