* fix: #995 - Fix onboarding state and model sorting * fix: typo
This commit is contained in:
parent
137bc0e8a5
commit
cb3055ca2e
@ -14,7 +14,7 @@ export type ModelInfo = {
|
|||||||
* @stored
|
* @stored
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum InferenceEngine {
|
export enum InferenceEngine {
|
||||||
nitro = 'nitro',
|
nitro = 'nitro',
|
||||||
openai = 'openai',
|
openai = 'openai',
|
||||||
triton_trtllm = 'triton_trtllm',
|
triton_trtllm = 'triton_trtllm',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { Model } from '@janhq/core'
|
import { InferenceEngine, Model } from '@janhq/core'
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Select,
|
Select,
|
||||||
@ -41,7 +41,14 @@ export default function DropdownListSidebar() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDownloadedModels().then((downloadedModels) => {
|
getDownloadedModels().then((downloadedModels) => {
|
||||||
setDownloadedModels(downloadedModels)
|
setDownloadedModels(
|
||||||
|
downloadedModels.sort((a, b) =>
|
||||||
|
a.engine !== InferenceEngine.nitro &&
|
||||||
|
b.engine === InferenceEngine.nitro
|
||||||
|
? 1
|
||||||
|
: -1
|
||||||
|
)
|
||||||
|
)
|
||||||
if (downloadedModels.length > 0) {
|
if (downloadedModels.length > 0) {
|
||||||
setSelected(
|
setSelected(
|
||||||
downloadedModels.filter(
|
downloadedModels.filter(
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { Fragment } from 'react'
|
|||||||
|
|
||||||
import ScrollToBottom from 'react-scroll-to-bottom'
|
import ScrollToBottom from 'react-scroll-to-bottom'
|
||||||
|
|
||||||
|
import { InferenceEngine } from '@janhq/core'
|
||||||
import { Button } from '@janhq/uikit'
|
import { Button } from '@janhq/uikit'
|
||||||
import { useAtomValue } from 'jotai'
|
import { useAtomValue } from 'jotai'
|
||||||
|
|
||||||
@ -41,6 +42,10 @@ const ChatBody: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const showOnboardingStep =
|
||||||
|
downloadedModels.filter((e) => e.engine === InferenceEngine.nitro)
|
||||||
|
.length === 0
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{messages.length === 0 ? (
|
{messages.length === 0 ? (
|
||||||
@ -50,7 +55,24 @@ const ChatBody: React.FC = () => {
|
|||||||
width={56}
|
width={56}
|
||||||
height={56}
|
height={56}
|
||||||
/>
|
/>
|
||||||
<p className="mt-1 text-base font-medium">How can I help you?</p>
|
{showOnboardingStep ? (
|
||||||
|
<>
|
||||||
|
<p className="mt-1 text-base font-medium">
|
||||||
|
{`You don't have a local model yet.`}
|
||||||
|
</p>
|
||||||
|
<div className="w-auto px-4 py-2">
|
||||||
|
<Button
|
||||||
|
block
|
||||||
|
className="bg-blue-100 font-bold text-blue-600 hover:bg-blue-100 hover:text-blue-600"
|
||||||
|
onClick={() => setMainViewState(MainViewState.Hub)}
|
||||||
|
>
|
||||||
|
Explore The Hub
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<p className="mt-1 text-base font-medium">How can I help you?</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<ScrollToBottom className="flex h-full w-full flex-col">
|
<ScrollToBottom className="flex h-full w-full flex-col">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user