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)
|
||||
},
|
||||
error: async (err: any) => {
|
||||
console.error(`Inference error: ${JSON.stringify(err, null, 2)}`)
|
||||
if (this.isCancelled || message.content.length) {
|
||||
message.status = MessageStatus.Stopped
|
||||
events.emit(MessageEvent.OnMessageUpdate, message)
|
||||
return
|
||||
}
|
||||
message.status = MessageStatus.Error
|
||||
message.content[0] = {
|
||||
type: ContentType.Text,
|
||||
text: {
|
||||
value: err.message,
|
||||
annotations: [],
|
||||
},
|
||||
}
|
||||
message.error_code = err.code
|
||||
events.emit(MessageEvent.OnMessageUpdate, message)
|
||||
},
|
||||
|
||||
@ -83,6 +83,8 @@ export enum MessageStatus {
|
||||
export enum ErrorCode {
|
||||
InvalidApiKey = 'invalid_api_key',
|
||||
|
||||
InsufficientQuota = 'insufficient_quota',
|
||||
|
||||
Unknown = 'unknown',
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ export class RetrievalTool extends InferenceTool {
|
||||
tool?: AssistantTool
|
||||
): Promise<MessageRequest> {
|
||||
if (!data.model || !data.messages) {
|
||||
return Promise.resolve(this.normalize(data))
|
||||
return Promise.resolve(data)
|
||||
}
|
||||
|
||||
const latestMessage = data.messages[data.messages.length - 1]
|
||||
@ -38,6 +38,8 @@ export class RetrievalTool extends InferenceTool {
|
||||
docFile,
|
||||
data.model?.engine
|
||||
)
|
||||
} else {
|
||||
return Promise.resolve(data)
|
||||
}
|
||||
} else if (
|
||||
// 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
|
||||
|
||||
return Promise.resolve(this.normalize(data))
|
||||
return Promise.resolve(data)
|
||||
}
|
||||
// 2. Load agent on thread changed
|
||||
if (this.retrievalThreadId !== data.threadId) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@janhq/model-extension",
|
||||
"version": "1.0.28",
|
||||
"version": "1.0.30",
|
||||
"description": "Model Management Extension provides model exploration and seamless downloads",
|
||||
"main": "dist/index.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"
|
||||
}
|
||||
],
|
||||
"id": "mistral-7b",
|
||||
"id": "mistral-ins-7b-q4",
|
||||
"object": "model",
|
||||
"name": "Mistral Instruct 7B Q4",
|
||||
"version": "1.0",
|
||||
@ -29,7 +29,7 @@
|
||||
"author": "MistralAI",
|
||||
"tags": ["Featured", "7B", "Foundational Model"],
|
||||
"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"
|
||||
}
|
||||
@ -5,7 +5,7 @@
|
||||
"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",
|
||||
"name": "Stealth 7B Q4",
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"id": "trinity-7b",
|
||||
"id": "trinity-v1.2-7b",
|
||||
"object": "model",
|
||||
"name": "Trinity-v1.2 7B Q4",
|
||||
"version": "1.0",
|
||||
@ -28,7 +28,7 @@
|
||||
"author": "Jan",
|
||||
"tags": ["7B", "Merged", "Featured"],
|
||||
"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"
|
||||
}
|
||||
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 ??
|
||||
activeThreadRef.current.assistants[0].model.id
|
||||
|
||||
if (base64Blob) {
|
||||
setFileUpload([])
|
||||
}
|
||||
|
||||
if (modelRef.current?.id !== modelId) {
|
||||
setQueuedMessage(true)
|
||||
const error = await startModel(modelId).catch((error: Error) => error)
|
||||
@ -261,10 +265,6 @@ export default function useSendChatMessage() {
|
||||
// Reset states
|
||||
setReloadModel(false)
|
||||
setEngineParamsUpdate(false)
|
||||
|
||||
if (base64Blob) {
|
||||
setFileUpload([])
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@ -3,6 +3,7 @@ import { Button } from '@janhq/uikit'
|
||||
import { useAtomValue, useSetAtom } from 'jotai'
|
||||
import { RefreshCcw } from 'lucide-react'
|
||||
|
||||
import AutoLink from '@/containers/AutoLink'
|
||||
import ModalTroubleShooting, {
|
||||
modalTroubleShootingAtom,
|
||||
} from '@/containers/ModalTroubleShoot'
|
||||
@ -110,9 +111,9 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
|
||||
) : (
|
||||
<div
|
||||
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>
|
||||
Jan’s in beta. Access
|
||||
<span
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useCallback } from 'react'
|
||||
import { useCallback, useState } from 'react'
|
||||
|
||||
import { Model } from '@janhq/core'
|
||||
import {
|
||||
@ -70,6 +70,7 @@ const ExploreModelItemHeader: React.FC<Props> = ({ model, onClick, open }) => {
|
||||
const { requestCreateNewThread } = useCreateNewThread()
|
||||
const totalRam = useAtomValue(totalRamAtom)
|
||||
const { settings } = useSettings()
|
||||
const [imageLoaded, setImageLoaded] = useState(true)
|
||||
|
||||
const nvidiaTotalVram = useAtomValue(nvidiaTotalVramAtom)
|
||||
const setMainViewState = useSetAtom(mainViewStateAtom)
|
||||
@ -143,9 +144,10 @@ const ExploreModelItemHeader: React.FC<Props> = ({ model, onClick, open }) => {
|
||||
className="cursor-pointer rounded-t-md bg-background"
|
||||
onClick={onClick}
|
||||
>
|
||||
{model.metadata.cover && (
|
||||
<div className="relative h-full w-full ">
|
||||
{model.metadata.cover && imageLoaded && (
|
||||
<div className="relative h-full w-full">
|
||||
<img
|
||||
onError={() => setImageLoaded(false)}
|
||||
src={model.metadata.cover}
|
||||
className="h-[250px] w-full object-cover"
|
||||
alt={`Cover - ${model.id}`}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user