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: api playground text overlap button and search hub model #3833

Merged
merged 2 commits into from
Oct 21, 2024
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
1 change: 1 addition & 0 deletions joi/src/core/Tabs/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
flex: 1;
height: 38px;
display: flex;
white-space: nowrap;
color: hsla(var(--text-secondary));
align-items: center;
justify-content: center;
Expand Down
22 changes: 12 additions & 10 deletions web/screens/Hub/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,19 @@ const HubScreen = () => {
{!filteredModels.length ? (
<BlankState title="No search results found" />
) : (
<div className="mb-4 flex w-full justify-end">
<Select
value={sortSelected}
onValueChange={(value) => {
setSortSelected(value)
}}
options={sortMenus}
/>
</div>
<>
<div className="mb-4 flex w-full justify-end">
<Select
value={sortSelected}
onValueChange={(value) => {
setSortSelected(value)
}}
options={sortMenus}
/>
</div>
<ModelList models={filteredModels} />
</>
)}
<ModelList models={filteredModels} />
</div>
</ScrollArea>
</CenterPanelContainer>
Expand Down
5 changes: 3 additions & 2 deletions web/screens/LocalServer/LocalServerLeftPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ const LocalServerLeftPanel = () => {
{serverEnabled ? 'Stop' : 'Start'} Server
</Button>
{serverEnabled && (
<Button variant="soft" asChild>
<Button variant="soft" asChild className="whitespace-nowrap">
<a href={`http://localhost:${port}`} target="_blank">
API Playground <ExternalLinkIcon size={20} className="ml-2" />
<span>API Playground</span>{' '}
<ExternalLinkIcon size={20} className="ml-2" />
</a>
</Button>
)}
Expand Down
7 changes: 2 additions & 5 deletions web/screens/Settings/Advanced/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
const selectedGpu = gpuList
.filter((x) => gpusInUse.includes(x.id))
.map((y) => {
return y['name']

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

View workflow job for this annotation

GitHub Actions / coverage-check

78 line is not covered with tests
})

/**
Expand All @@ -88,7 +88,7 @@
if (value.trim().startsWith('http')) {
setProxy(value.trim())
} else {
setProxy('')

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

View workflow job for this annotation

GitHub Actions / coverage-check

91 line is not covered with tests
}
},
[setPartialProxy, setProxy]
Expand All @@ -105,10 +105,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 111 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

108-111 lines are not covered with tests
}

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

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

View workflow job for this annotation

GitHub Actions / coverage-check

121 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 127 in web/screens/Settings/Advanced/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

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

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

View workflow job for this annotation

GitHub Actions / coverage-check

129 line is not covered with tests
}

/**
Expand Down Expand Up @@ -174,7 +174,7 @@
try {
await fs.rm(`file://logs`)
} catch (err) {
console.error('Error clearing logs: ', err)

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

View workflow job for this annotation

GitHub Actions / coverage-check

177 line is not covered with tests
}

toaster({
Expand All @@ -190,15 +190,15 @@
* @returns
*/
const handleGPUChange = (gpuId: string) => {
let updatedGpusInUse = [...gpusInUse]
if (updatedGpusInUse.includes(gpuId)) {
updatedGpusInUse = updatedGpusInUse.filter((id) => id !== gpuId)
if (gpuEnabled && updatedGpusInUse.length === 0) {

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

View workflow job for this annotation

GitHub Actions / coverage-check

193-196 lines are not covered with tests
// Vulkan support only allow 1 active device at a time
if (vulkanEnabled) {
updatedGpusInUse = []

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

View workflow job for this annotation

GitHub Actions / coverage-check

198-199 lines are not covered with tests
}
updatedGpusInUse.push(gpuId)

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

View workflow job for this annotation

GitHub Actions / coverage-check

201 line is not covered with tests
}
} else {
// Vulkan support only allow 1 active device at a time
Expand All @@ -211,9 +211,6 @@
saveSettings({ gpusInUse: updatedGpusInUse })
}

const gpuSelectionPlaceHolder =
gpuList.length > 0 ? 'Select GPU' : "You don't have any compatible GPU"

/**
* Handle click outside
*/
Expand All @@ -240,7 +237,7 @@
</div>

{/* CPU / GPU switching */}
{!isMac && (
{!isMac && gpuList.length > 0 && (
<div className="flex w-full flex-col items-start justify-between border-b border-[hsla(var(--app-border))] py-4 first:pt-0 last:border-none">
<div className="flex w-full items-start justify-between">
<div className="space-y-1">
Expand Down Expand Up @@ -326,7 +323,7 @@
value={selectedGpu.join() || ''}
className="w-full cursor-pointer"
readOnly
placeholder={gpuSelectionPlaceHolder}
placeholder=""
suffixIcon={
<ChevronDownIcon
size={14}
Expand Down
Loading