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

Sync main to dev (0.4.11) #2725

Merged
merged 14 commits into from
Apr 15, 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
4 changes: 2 additions & 2 deletions core/src/browser/extensions/engines/LocalOAIEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ export abstract class LocalOAIEngine extends OAIEngine {
/**
* Stops the model.
*/
override async unloadModel(model?: Model): Promise<void> {
override async unloadModel(model?: Model) {
if (model?.engine && model.engine?.toString() !== this.provider) return Promise.resolve()

this.loadedModel = undefined
return executeOnMain(this.nodeModule, this.unloadModelFunctionName).then(() => {
await executeOnMain(this.nodeModule, this.unloadModelFunctionName).then(() => {
events.emit(ModelEvent.OnModelStopped, {})
})
}
Expand Down
3 changes: 2 additions & 1 deletion electron/managers/mainWindowConfig.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
const DEFAULT_WIDTH = 1200
const DEFAULT_MIN_WIDTH = 400
const DEFAULT_HEIGHT = 800

export const mainWindowConfig: Electron.BrowserWindowConstructorOptions = {
width: DEFAULT_WIDTH,
minWidth: DEFAULT_WIDTH,
minWidth: DEFAULT_MIN_WIDTH,
height: DEFAULT_HEIGHT,
skipTaskbar: false,
show: true,
Expand Down
2 changes: 1 addition & 1 deletion extensions/assistant-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/assistant-extension",
"productName": "Jan Assistant Extension",
"productName": "Jan Assistant",
"version": "1.0.1",
"description": "This extension enables assistants, including Jan, a default assistant that can call all downloaded models",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion extensions/conversational-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/conversational-extension",
"productName": "Conversational Extension",
"productName": "Conversational",
"version": "1.0.0",
"description": "This extension enables conversations and state persistence via your filesystem",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion extensions/huggingface-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/huggingface-extension",
"productName": "HuggingFace Extension",
"productName": "HuggingFace",
"version": "1.0.0",
"description": "Hugging Face extension for converting HF models to GGUF",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion extensions/inference-groq-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/inference-groq-extension",
"productName": "Groq Inference Engine Extension",
"productName": "Groq Inference Engine",
"version": "1.0.0",
"description": "This extension enables fast Groq chat completion API calls",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion extensions/inference-mistral-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/inference-mistral-extension",
"productName": "Mistral AI Inference Engine Extension",
"productName": "MistralAI Inference Engine",
"version": "1.0.0",
"description": "This extension enables Mistral chat completion API calls",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion extensions/inference-nitro-extension/bin/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.21
0.3.16-hotfix
6 changes: 3 additions & 3 deletions extensions/inference-nitro-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@janhq/inference-nitro-extension",
"productName": "Nitro Inference Engine Extension",
"version": "1.0.0",
"description": "This extension embeds Nitro, a lightweight (3mb) inference engine written in C++. See https://nitro.jan.ai.\nUse this setting if you encounter errors related to **CUDA toolkit** during application execution.",
"productName": "Nitro Inference Engine",
"version": "1.0.1",
"description": "This extension embeds Nitro, a lightweight (3mb) inference engine written in C++. See https://nitro.jan.ai.\nAdditional dependencies could be installed to run without Cuda Toolkit installation.",
"main": "dist/index.js",
"node": "dist/node/index.cjs.js",
"author": "Jan <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"id": "command-r-34b",
"object": "model",
"name": "Command-R v01 34B Q4",
"version": "1.0",
"version": "1.1",
"description": "C4AI Command-R developed by CohereAI is optimized for a variety of use cases including reasoning, summarization, and question answering.",
"format": "gguf",
"settings": {
Expand All @@ -27,7 +27,7 @@
},
"metadata": {
"author": "CohereAI",
"tags": ["34B", "Finetuned"],
"tags": ["34B", "Finetuned", "Coming Soon", "Unavailable"],
"size": 21500000000
},
"engine": "nitro"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"sources": [
{
"filename": "wizardcoder-python-13b-v1.0.Q5_K_M.gguf",
"url": "https://huggingface.co/TheBloke/WizardCoder-Python-13B-V1.0-GGUF/resolve/main/wizardcoder-python-13b-v1.0.Q5_K_M.gguf"
"filename": "wizardcoder-python-13b-v1.0.Q4_K_M.gguf",
"url": "https://huggingface.co/TheBloke/WizardCoder-Python-13B-V1.0-GGUF/resolve/main/wizardcoder-python-13b-v1.0.Q4_K_M.gguf"
}
],
"id": "wizardcoder-13b",
"object": "model",
"name": "Wizard Coder Python 13B Q5",
"version": "1.0",
"name": "Wizard Coder Python 13B Q4",
"version": "1.1",
"description": "WizardCoder 13B is a Python coding model. This model demonstrate high proficiency in specific domains like coding and mathematics.",
"format": "gguf",
"settings": {
"ctx_len": 4096,
"prompt_template": "### Instruction:\n{prompt}\n### Response:",
"llama_model_path": "wizardcoder-python-13b-v1.0.Q5_K_M.gguf"
"llama_model_path": "wizardcoder-python-13b-v1.0.Q4_K_M.gguf"
},
"parameters": {
"temperature": 0.7,
Expand Down
2 changes: 1 addition & 1 deletion extensions/inference-nitro-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default class JanInferenceNitroExtension extends LocalOAIEngine {
return super.loadModel(model)
}

override async unloadModel(model?: Model) {
override async unloadModel(model?: Model): Promise<void> {
if (model?.engine && model.engine !== this.provider) return

// stop the periocally health check
Expand Down
6 changes: 3 additions & 3 deletions extensions/inference-nitro-extension/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,14 @@ async function killSubprocess(): Promise<void> {
return new Promise((resolve, reject) => {
terminate(pid, function (err) {
if (err) {
return killRequest()
killRequest().then(resolve).catch(reject)
} else {
return tcpPortUsed
tcpPortUsed
.waitUntilFree(PORT, NITRO_PORT_FREE_CHECK_INTERVAL, 5000)
.then(() => resolve())
.then(() => log(`[NITRO]::Debug: Nitro process is terminated`))
.catch(() => {
killRequest()
killRequest().then(resolve).catch(reject)
})
}
})
Expand Down
2 changes: 1 addition & 1 deletion extensions/inference-openai-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/inference-openai-extension",
"productName": "OpenAI Inference Engine Extension",
"productName": "OpenAI Inference Engine",
"version": "1.0.0",
"description": "This extension enables OpenAI chat completion API calls",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion extensions/inference-triton-trtllm-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/inference-triton-trt-llm-extension",
"productName": "Triton-TRT-LLM Inference Engine Extension",
"productName": "Triton-TRT-LLM Inference Engine",
"version": "1.0.0",
"description": "This extension enables Nvidia's TensorRT-LLM as an inference engine option",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion extensions/model-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/model-extension",
"productName": "Model Management Extension",
"productName": "Model Management",
"version": "1.0.30",
"description": "Model Management Extension provides model exploration and seamless downloads",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion extensions/monitoring-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/monitoring-extension",
"productName": "System Monitoring Extension",
"productName": "System Monitoring",
"version": "1.0.10",
"description": "This extension provides system health and OS level data",
"main": "dist/index.js",
Expand Down
4 changes: 3 additions & 1 deletion extensions/monitoring-extension/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const DEFAULT_SETTINGS: GpuSetting = {

export const getGpuConfig = async (): Promise<GpuSetting | undefined> => {
if (process.platform === 'darwin') return undefined
return JSON.parse(readFileSync(GPU_INFO_FILE, 'utf-8'))
if (existsSync(GPU_INFO_FILE))
return JSON.parse(readFileSync(GPU_INFO_FILE, 'utf-8'))
return DEFAULT_SETTINGS
}

export const getResourcesInfo = async (): Promise<ResourceInfo> => {
Expand Down
2 changes: 1 addition & 1 deletion extensions/tensorrt-llm-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@janhq/tensorrt-llm-extension",
"productName": "TensorRT-LLM Inference Engine Extension",
"productName": "TensorRT-LLM Inference Engine",
"version": "0.0.3",
"description": "This extension enables Nvidia's TensorRT-LLM for the fastest GPU acceleration. See the [setup guide](https://jan.ai/guides/providers/tensorrt-llm/) for next steps.",
"main": "dist/index.js",
Expand Down
6 changes: 3 additions & 3 deletions web/containers/Checkbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { InfoIcon } from 'lucide-react'
type Props = {
name: string
title: string
enabled?: boolean
disabled?: boolean
description: string
checked: boolean
onValueChanged?: (e: string | number | boolean) => void
Expand All @@ -23,7 +23,7 @@ type Props = {
const Checkbox: React.FC<Props> = ({
title,
checked,
enabled = true,
disabled = false,
description,
onValueChanged,
}) => {
Expand Down Expand Up @@ -52,7 +52,7 @@ const Checkbox: React.FC<Props> = ({
<Switch
checked={checked}
onCheckedChange={onCheckedChange}
disabled={!enabled}
disabled={disabled}
/>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion web/containers/DropdownListSidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ const DropdownListSidebar = ({
{toGibibytes(x.metadata.size)}
</span>
{x.metadata.size && (
<ModelLabel size={x.metadata.size} />
<ModelLabel metadata={x.metadata} />
)}
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion web/containers/Layout/TopBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import CommandSearch from '@/containers/Layout/TopBar/CommandSearch'

import { showLeftSideBarAtom } from '@/containers/Providers/KeyListener'

import { toaster } from '@/containers/Toast'

import { MainViewState } from '@/constants/screens'

import { useClickOutside } from '@/hooks/useClickOutside'
Expand Down Expand Up @@ -61,7 +63,11 @@ const TopBar = () => {

const onCreateConversationClick = async () => {
if (assistants.length === 0) {
alert('No assistant available')
toaster({
title: 'No assistant available.',
description: `Could not create a new thread. Please add an assistant.`,
type: 'error',
})
} else {
requestCreateNewThread(assistants[0])
}
Expand Down
6 changes: 3 additions & 3 deletions web/containers/ModelConfigInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { InfoIcon } from 'lucide-react'

type Props = {
title: string
enabled?: boolean
disabled?: boolean
name: string
description: string
placeholder: string
Expand All @@ -21,7 +21,7 @@ type Props = {

const ModelConfigInput: React.FC<Props> = ({
title,
enabled = true,
disabled = false,
value,
description,
placeholder,
Expand All @@ -48,7 +48,7 @@ const ModelConfigInput: React.FC<Props> = ({
placeholder={placeholder}
onChange={(e) => onValueChanged?.(e.target.value)}
value={value}
disabled={!enabled}
disabled={disabled}
/>
</div>
)
Expand Down
19 changes: 16 additions & 3 deletions web/containers/ModelLabel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react'

import { ModelMetadata } from '@janhq/core'
import { Badge } from '@janhq/uikit'
import { useAtomValue } from 'jotai'

import { useActiveModel } from '@/hooks/useActiveModel'
Expand All @@ -19,10 +21,17 @@ import {
} from '@/helpers/atoms/SystemBar.atom'

type Props = {
size: number
metadata: ModelMetadata
}
const UnsupportedModel = () => {
return (
<Badge className="space-x-1 rounded-md" themes="warning">
<span>Coming Soon</span>
</Badge>
)
}

const ModelLabel: React.FC<Props> = ({ size }) => {
const ModelLabel: React.FC<Props> = ({ metadata }) => {
const { activeModel } = useActiveModel()
const totalRam = useAtomValue(totalRamAtom)
const usedRam = useAtomValue(usedRamAtom)
Expand Down Expand Up @@ -52,7 +61,11 @@ const ModelLabel: React.FC<Props> = ({ size }) => {
return null
}

return getLabel(size)
return metadata.tags.includes('Coming Soon') ? (
<UnsupportedModel />
) : (
getLabel(metadata.size ?? 0)
)
}

export default React.memo(ModelLabel)
15 changes: 14 additions & 1 deletion web/containers/Providers/KeyListener.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

import { Fragment, ReactNode, useEffect } from 'react'

import { atom, useSetAtom } from 'jotai'
import { atom, useAtomValue, useSetAtom } from 'jotai'

import { MainViewState } from '@/constants/screens'

import { useCreateNewThread } from '@/hooks/useCreateNewThread'

import { mainViewStateAtom } from '@/helpers/atoms/App.atom'
import { assistantsAtom } from '@/helpers/atoms/Assistant.atom'

type Props = {
children: ReactNode
Expand All @@ -21,11 +24,19 @@ export default function KeyListener({ children }: Props) {
const setShowSelectModelModal = useSetAtom(showSelectModelModalAtom)
const setMainViewState = useSetAtom(mainViewStateAtom)
const showCommandSearchModal = useSetAtom(showCommandSearchModalAtom)
const { requestCreateNewThread } = useCreateNewThread()
const assistants = useAtomValue(assistantsAtom)

useEffect(() => {
const onKeyDown = (e: KeyboardEvent) => {
const prefixKey = isMac ? e.metaKey : e.ctrlKey

if (e.key === 'n' && prefixKey) {
requestCreateNewThread(assistants[0])
setMainViewState(MainViewState.Thread)
return
}

if (e.key === 'b' && prefixKey) {
setShowLeftSideBar((showLeftSideBar) => !showLeftSideBar)
return
Expand All @@ -49,6 +60,8 @@ export default function KeyListener({ children }: Props) {
document.addEventListener('keydown', onKeyDown)
return () => document.removeEventListener('keydown', onKeyDown)
}, [
assistants,
requestCreateNewThread,
setMainViewState,
setShowLeftSideBar,
setShowSelectModelModal,
Expand Down
5 changes: 5 additions & 0 deletions web/containers/ShortcutModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import {
} from '@janhq/uikit'

const availableShortcuts = [
{
combination: 'N',
modifierKeys: [isMac ? '⌘' : 'Ctrl'],
description: 'Create a new thread',
},
{
combination: 'E',
modifierKeys: [isMac ? '⌘' : 'Ctrl'],
Expand Down
Loading
Loading