Merge branch 'main' into dev
# Conflicts: # web/screens/Chat/ErrorMessage/index.tsx
This commit is contained in:
commit
f6d3b53ab5
@ -102,12 +102,20 @@ export abstract class OAIEngine extends AIEngine {
|
|||||||
events.emit(MessageEvent.OnMessageUpdate, message)
|
events.emit(MessageEvent.OnMessageUpdate, message)
|
||||||
},
|
},
|
||||||
error: async (err: any) => {
|
error: async (err: any) => {
|
||||||
|
console.error(`Inference error: ${JSON.stringify(err, null, 2)}`)
|
||||||
if (this.isCancelled || message.content.length) {
|
if (this.isCancelled || message.content.length) {
|
||||||
message.status = MessageStatus.Stopped
|
message.status = MessageStatus.Stopped
|
||||||
events.emit(MessageEvent.OnMessageUpdate, message)
|
events.emit(MessageEvent.OnMessageUpdate, message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message.status = MessageStatus.Error
|
message.status = MessageStatus.Error
|
||||||
|
message.content[0] = {
|
||||||
|
type: ContentType.Text,
|
||||||
|
text: {
|
||||||
|
value: err.message,
|
||||||
|
annotations: [],
|
||||||
|
},
|
||||||
|
}
|
||||||
message.error_code = err.code
|
message.error_code = err.code
|
||||||
events.emit(MessageEvent.OnMessageUpdate, message)
|
events.emit(MessageEvent.OnMessageUpdate, message)
|
||||||
},
|
},
|
||||||
|
|||||||
@ -83,6 +83,8 @@ export enum MessageStatus {
|
|||||||
export enum ErrorCode {
|
export enum ErrorCode {
|
||||||
InvalidApiKey = 'invalid_api_key',
|
InvalidApiKey = 'invalid_api_key',
|
||||||
|
|
||||||
|
InsufficientQuota = 'insufficient_quota',
|
||||||
|
|
||||||
Unknown = 'unknown',
|
Unknown = 'unknown',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export class RetrievalTool extends InferenceTool {
|
|||||||
tool?: AssistantTool
|
tool?: AssistantTool
|
||||||
): Promise<MessageRequest> {
|
): Promise<MessageRequest> {
|
||||||
if (!data.model || !data.messages) {
|
if (!data.model || !data.messages) {
|
||||||
return Promise.resolve(this.normalize(data))
|
return Promise.resolve(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
const latestMessage = data.messages[data.messages.length - 1]
|
const latestMessage = data.messages[data.messages.length - 1]
|
||||||
@ -38,6 +38,8 @@ export class RetrievalTool extends InferenceTool {
|
|||||||
docFile,
|
docFile,
|
||||||
data.model?.engine
|
data.model?.engine
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(data)
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
// Check whether we need to ingest document or not
|
// Check whether we need to ingest document or not
|
||||||
@ -48,7 +50,7 @@ export class RetrievalTool extends InferenceTool {
|
|||||||
) {
|
) {
|
||||||
// No document ingested, reroute the result to inference engine
|
// No document ingested, reroute the result to inference engine
|
||||||
|
|
||||||
return Promise.resolve(this.normalize(data))
|
return Promise.resolve(data)
|
||||||
}
|
}
|
||||||
// 2. Load agent on thread changed
|
// 2. Load agent on thread changed
|
||||||
if (this.retrievalThreadId !== data.threadId) {
|
if (this.retrievalThreadId !== data.threadId) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@janhq/model-extension",
|
"name": "@janhq/model-extension",
|
||||||
"version": "1.0.28",
|
"version": "1.0.30",
|
||||||
"description": "Model Management Extension provides model exploration and seamless downloads",
|
"description": "Model Management Extension provides model exploration and seamless downloads",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/module.js",
|
"module": "dist/module.js",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 229 KiB After Width: | Height: | Size: 229 KiB |
@ -5,7 +5,7 @@
|
|||||||
"url": "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf"
|
"url": "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": "mistral-7b",
|
"id": "mistral-ins-7b-q4",
|
||||||
"object": "model",
|
"object": "model",
|
||||||
"name": "Mistral Instruct 7B Q4",
|
"name": "Mistral Instruct 7B Q4",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"author": "MistralAI",
|
"author": "MistralAI",
|
||||||
"tags": ["Featured", "7B", "Foundational Model"],
|
"tags": ["Featured", "7B", "Foundational Model"],
|
||||||
"size": 4370000000,
|
"size": 4370000000,
|
||||||
"cover": "https://raw.githubusercontent.com/janhq/jan/dev/models/mistral-7b/cover.png"
|
"cover": "https://raw.githubusercontent.com/janhq/jan/dev/models/mistral-ins-7b-q4/cover.png"
|
||||||
},
|
},
|
||||||
"engine": "nitro"
|
"engine": "nitro"
|
||||||
}
|
}
|
||||||
@ -5,7 +5,7 @@
|
|||||||
"url": "https://huggingface.co/janhq/stealth-v1.3-GGUF/resolve/main/stealth-v1.3.Q4_K_M.gguf"
|
"url": "https://huggingface.co/janhq/stealth-v1.3-GGUF/resolve/main/stealth-v1.3.Q4_K_M.gguf"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": "stealth-7b",
|
"id": "stealth-v1.2-7b",
|
||||||
"object": "model",
|
"object": "model",
|
||||||
"name": "Stealth 7B Q4",
|
"name": "Stealth 7B Q4",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
34
models/tinyllama-1.1b/model.json
Normal file
34
models/tinyllama-1.1b/model.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"filename": "tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf",
|
||||||
|
"url": "https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "tinyllama-1.1b",
|
||||||
|
"object": "model",
|
||||||
|
"name": "TinyLlama Chat 1.1B Q4",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "TinyLlama is a tiny model with only 1.1B. It's a good model for less powerful computers.",
|
||||||
|
"format": "gguf",
|
||||||
|
"settings": {
|
||||||
|
"ctx_len": 4096,
|
||||||
|
"prompt_template": "<|system|>\n{system_message}<|user|>\n{prompt}<|assistant|>",
|
||||||
|
"llama_model_path": "tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf"
|
||||||
|
},
|
||||||
|
"parameters": {
|
||||||
|
"temperature": 0.7,
|
||||||
|
"top_p": 0.95,
|
||||||
|
"stream": true,
|
||||||
|
"max_tokens": 2048,
|
||||||
|
"stop": [],
|
||||||
|
"frequency_penalty": 0,
|
||||||
|
"presence_penalty": 0
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"author": "TinyLlama",
|
||||||
|
"tags": ["Tiny", "Foundation Model"],
|
||||||
|
"size": 669000000
|
||||||
|
},
|
||||||
|
"engine": "nitro"
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 352 KiB After Width: | Height: | Size: 352 KiB |
@ -5,7 +5,7 @@
|
|||||||
"url": "https://huggingface.co/janhq/trinity-v1.2-GGUF/resolve/main/trinity-v1.2.Q4_K_M.gguf"
|
"url": "https://huggingface.co/janhq/trinity-v1.2-GGUF/resolve/main/trinity-v1.2.Q4_K_M.gguf"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": "trinity-7b",
|
"id": "trinity-v1.2-7b",
|
||||||
"object": "model",
|
"object": "model",
|
||||||
"name": "Trinity-v1.2 7B Q4",
|
"name": "Trinity-v1.2 7B Q4",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
@ -28,7 +28,7 @@
|
|||||||
"author": "Jan",
|
"author": "Jan",
|
||||||
"tags": ["7B", "Merged", "Featured"],
|
"tags": ["7B", "Merged", "Featured"],
|
||||||
"size": 4370000000,
|
"size": 4370000000,
|
||||||
"cover": "https://raw.githubusercontent.com/janhq/jan/dev/models/trinity-7b/cover.png"
|
"cover": "https://raw.githubusercontent.com/janhq/jan/dev/models/trinity-v1.2-7b/cover.png"
|
||||||
},
|
},
|
||||||
"engine": "nitro"
|
"engine": "nitro"
|
||||||
}
|
}
|
||||||
34
web/containers/AutoLink/index.tsx
Normal file
34
web/containers/AutoLink/index.tsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
text: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const AutoLink: React.FC<Props> = ({ text }) => {
|
||||||
|
const delimiter =
|
||||||
|
/((?:https?:\/\/)?(?:(?:[a-z0-9]?(?:[a-z0-9-]{1,61}[a-z0-9])?\.[^.|\s])+[a-z.]*[a-z]+|(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})(?::\d{1,5})*[a-z0-9.,_/~#&=;%+?\-\\(\\)]*)/gi
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{text.split(delimiter).map((word) => {
|
||||||
|
const match = word.match(delimiter)
|
||||||
|
if (match) {
|
||||||
|
const url = match[0]
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
key={url}
|
||||||
|
target="blank"
|
||||||
|
href={url.startsWith('http') ? url : `http://${url}`}
|
||||||
|
className="text-primary dark:text-blue-400"
|
||||||
|
>
|
||||||
|
{url}
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return word
|
||||||
|
})}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default React.memo(AutoLink)
|
||||||
@ -234,6 +234,10 @@ export default function useSendChatMessage() {
|
|||||||
selectedModelRef.current?.id ??
|
selectedModelRef.current?.id ??
|
||||||
activeThreadRef.current.assistants[0].model.id
|
activeThreadRef.current.assistants[0].model.id
|
||||||
|
|
||||||
|
if (base64Blob) {
|
||||||
|
setFileUpload([])
|
||||||
|
}
|
||||||
|
|
||||||
if (modelRef.current?.id !== modelId) {
|
if (modelRef.current?.id !== modelId) {
|
||||||
setQueuedMessage(true)
|
setQueuedMessage(true)
|
||||||
const error = await startModel(modelId).catch((error: Error) => error)
|
const error = await startModel(modelId).catch((error: Error) => error)
|
||||||
@ -261,10 +265,6 @@ export default function useSendChatMessage() {
|
|||||||
// Reset states
|
// Reset states
|
||||||
setReloadModel(false)
|
setReloadModel(false)
|
||||||
setEngineParamsUpdate(false)
|
setEngineParamsUpdate(false)
|
||||||
|
|
||||||
if (base64Blob) {
|
|
||||||
setFileUpload([])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { Button } from '@janhq/uikit'
|
|||||||
import { useAtomValue, useSetAtom } from 'jotai'
|
import { useAtomValue, useSetAtom } from 'jotai'
|
||||||
import { RefreshCcw } from 'lucide-react'
|
import { RefreshCcw } from 'lucide-react'
|
||||||
|
|
||||||
|
import AutoLink from '@/containers/AutoLink'
|
||||||
import ModalTroubleShooting, {
|
import ModalTroubleShooting, {
|
||||||
modalTroubleShootingAtom,
|
modalTroubleShootingAtom,
|
||||||
} from '@/containers/ModalTroubleShoot'
|
} from '@/containers/ModalTroubleShoot'
|
||||||
@ -110,9 +111,9 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
|
|||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
key={message.id}
|
key={message.id}
|
||||||
className="flex flex-col items-center text-center text-sm font-medium text-gray-500"
|
className="mx-6 flex flex-col items-center space-y-2 text-center text-sm font-medium text-gray-500"
|
||||||
>
|
>
|
||||||
{getErrorTitle()}
|
<AutoLink text={getErrorTitle()} />
|
||||||
<p>
|
<p>
|
||||||
Jan’s in beta. Access
|
Jan’s in beta. Access
|
||||||
<span
|
<span
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useCallback } from 'react'
|
import { useCallback, useState } from 'react'
|
||||||
|
|
||||||
import { Model } from '@janhq/core'
|
import { Model } from '@janhq/core'
|
||||||
import {
|
import {
|
||||||
@ -70,6 +70,7 @@ const ExploreModelItemHeader: React.FC<Props> = ({ model, onClick, open }) => {
|
|||||||
const { requestCreateNewThread } = useCreateNewThread()
|
const { requestCreateNewThread } = useCreateNewThread()
|
||||||
const totalRam = useAtomValue(totalRamAtom)
|
const totalRam = useAtomValue(totalRamAtom)
|
||||||
const { settings } = useSettings()
|
const { settings } = useSettings()
|
||||||
|
const [imageLoaded, setImageLoaded] = useState(true)
|
||||||
|
|
||||||
const nvidiaTotalVram = useAtomValue(nvidiaTotalVramAtom)
|
const nvidiaTotalVram = useAtomValue(nvidiaTotalVramAtom)
|
||||||
const setMainViewState = useSetAtom(mainViewStateAtom)
|
const setMainViewState = useSetAtom(mainViewStateAtom)
|
||||||
@ -143,9 +144,10 @@ const ExploreModelItemHeader: React.FC<Props> = ({ model, onClick, open }) => {
|
|||||||
className="cursor-pointer rounded-t-md bg-background"
|
className="cursor-pointer rounded-t-md bg-background"
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{model.metadata.cover && (
|
{model.metadata.cover && imageLoaded && (
|
||||||
<div className="relative h-full w-full ">
|
<div className="relative h-full w-full">
|
||||||
<img
|
<img
|
||||||
|
onError={() => setImageLoaded(false)}
|
||||||
src={model.metadata.cover}
|
src={model.metadata.cover}
|
||||||
className="h-[250px] w-full object-cover"
|
className="h-[250px] w-full object-cover"
|
||||||
alt={`Cover - ${model.id}`}
|
alt={`Cover - ${model.id}`}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user