* chore: expose fs apis * chore: correct electron import path * update download api Signed-off-by: James <james@jan.ai> * update chat_completion Signed-off-by: James <james@jan.ai> * fix electron import Signed-off-by: James <james@jan.ai> * feat: adding API support at 1337 (#991) Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai> * feat: Add /chat/completion api and handler * chore: add todo for modelList * chore: read engine.json for openai chat_completion (#1030) Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai> * refactor: move routes to shared node module * refactor: exported modules from core with types (#1172) * refactor: exported modules from core with types * fix: fix file reading args * refactor: fileManager handles * fix: app issues with server refactoring * refactor: shared server module (#1210) * chore: resolve main * chore: update makefile --------- Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai> Co-authored-by: NamH <NamNh0122@gmail.com> Co-authored-by: hiro <vuonghoainam.work@gmail.com>
66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
import { useState } from 'react'
|
|
|
|
import { Input } from '@janhq/uikit'
|
|
|
|
import { SearchIcon } from 'lucide-react'
|
|
|
|
import { useGetDownloadedModels } from '@/hooks/useGetDownloadedModels'
|
|
|
|
import RowModel from './Row'
|
|
|
|
const Column = ['Name', 'Model ID', 'Size', 'Version', 'Status', '']
|
|
|
|
export default function Models() {
|
|
const { downloadedModels } = useGetDownloadedModels()
|
|
const [searchValue, setsearchValue] = useState('')
|
|
|
|
const filteredDownloadedModels = downloadedModels.filter((x) => {
|
|
return x.name?.toLowerCase().includes(searchValue.toLowerCase())
|
|
})
|
|
|
|
return (
|
|
<div className="rounded-xl border border-border shadow-sm">
|
|
<div className="px-6 py-5">
|
|
<div className="relative w-1/3">
|
|
<SearchIcon
|
|
size={20}
|
|
className="absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"
|
|
/>
|
|
<Input
|
|
placeholder="Search"
|
|
className="pl-8"
|
|
onChange={(e) => {
|
|
setsearchValue(e.target.value)
|
|
}}
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="relative">
|
|
<table className="w-full px-8">
|
|
<thead className="w-full border-b border-border bg-secondary">
|
|
<tr>
|
|
{Column.map((col, i) => {
|
|
return (
|
|
<th
|
|
key={i}
|
|
className="px-6 py-2 text-left font-normal last:text-center"
|
|
>
|
|
{col}
|
|
</th>
|
|
)
|
|
})}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{filteredDownloadedModels
|
|
? filteredDownloadedModels.map((x, i) => {
|
|
return <RowModel key={i} data={x} />
|
|
})
|
|
: null}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|