Merge branch 'docs/add-requirements' of https://github.com/janhq/jan into docs/add-requirements

This commit is contained in:
hieu-jan 2024-01-24 10:44:27 +09:00
commit 8b7f90255d
13 changed files with 80 additions and 42 deletions

View File

@ -69,9 +69,9 @@ jobs:
if: github.event_name == 'schedule' if: github.event_name == 'schedule'
uses: ./.github/workflows/template-noti-discord-and-update-url-readme.yml uses: ./.github/workflows/template-noti-discord-and-update-url-readme.yml
with: with:
ref: refs/heads/main ref: refs/heads/dev
build_reason: Nightly build_reason: Nightly
push_to_branch: main push_to_branch: dev
new_version: ${{ needs.get-update-version.outputs.new_version }} new_version: ${{ needs.get-update-version.outputs.new_version }}
noti-discord-manual-and-update-url-readme: noti-discord-manual-and-update-url-readme:
@ -80,7 +80,7 @@ jobs:
if: github.event_name == 'workflow_dispatch' && github.event.inputs.public_provider == 'cloudflare-r2' if: github.event_name == 'workflow_dispatch' && github.event.inputs.public_provider == 'cloudflare-r2'
uses: ./.github/workflows/template-noti-discord-and-update-url-readme.yml uses: ./.github/workflows/template-noti-discord-and-update-url-readme.yml
with: with:
ref: refs/heads/main ref: refs/heads/dev
build_reason: Manual build_reason: Manual
push_to_branch: main push_to_branch: dev
new_version: ${{ needs.get-update-version.outputs.new_version }} new_version: ${{ needs.get-update-version.outputs.new_version }}

View File

@ -46,7 +46,7 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/template-noti-discord-and-update-url-readme.yml uses: ./.github/workflows/template-noti-discord-and-update-url-readme.yml
with: with:
ref: refs/heads/main ref: refs/heads/dev
build_reason: Nightly build_reason: Nightly
push_to_branch: main push_to_branch: dev
new_version: ${{ needs.get-update-version.outputs.new_version }} new_version: ${{ needs.get-update-version.outputs.new_version }}

View File

@ -58,7 +58,7 @@ jobs:
mv /tmp/package.json electron/package.json mv /tmp/package.json electron/package.json
jq --arg version "${{ inputs.new_version }}" '.version = $version' web/package.json > /tmp/package.json jq --arg version "${{ inputs.new_version }}" '.version = $version' web/package.json > /tmp/package.json
mv /tmp/package.json web/package.json mv /tmp/package.json web/package.json
jq '.build.publish = [{"provider": "s3", "bucket": "${{ secrets.CLOUDFLARE_R2_BUCKET_NAME }}", "region": "auto", "endpoint": "https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com", "path": "${{ inputs.cloudflare_r2_path }}", "channel": "latest"}]' electron/package.json > /tmp/package.json jq '.build.publish = [{"provider": "generic", "url": "${{ secrets.CLOUDFLARE_R2_PUBLIC_URL }}", "channel": "latest"}, {"provider": "s3", "bucket": "${{ secrets.CLOUDFLARE_R2_BUCKET_NAME }}", "region": "auto", "endpoint": "https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com", "path": "${{ inputs.cloudflare_r2_path }}", "channel": "latest"}]' electron/package.json > /tmp/package.json
mv /tmp/package.json electron/package.json mv /tmp/package.json electron/package.json
cat electron/package.json cat electron/package.json

View File

@ -1,4 +1,4 @@
name: build-linux-x64 name: build-macos
on: on:
workflow_call: workflow_call:
inputs: inputs:
@ -70,7 +70,7 @@ jobs:
jq --arg version "${{ inputs.new_version }}" '.version = $version' web/package.json > /tmp/package.json jq --arg version "${{ inputs.new_version }}" '.version = $version' web/package.json > /tmp/package.json
mv /tmp/package.json web/package.json mv /tmp/package.json web/package.json
jq '.build.publish = [{"provider": "s3", "bucket": "${{ secrets.CLOUDFLARE_R2_BUCKET_NAME }}", "region": "auto", "endpoint": "https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com", "path": "${{ inputs.cloudflare_r2_path }}", "channel": "latest"}]' electron/package.json > /tmp/package.json jq '.build.publish = [{"provider": "generic", "url": "${{ secrets.CLOUDFLARE_R2_PUBLIC_URL }}", "channel": "latest"}, {"provider": "s3", "bucket": "${{ secrets.CLOUDFLARE_R2_BUCKET_NAME }}", "region": "auto", "endpoint": "https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com", "path": "${{ inputs.cloudflare_r2_path }}", "channel": "latest"}]' electron/package.json > /tmp/package.json
mv /tmp/package.json electron/package.json mv /tmp/package.json electron/package.json
cat electron/package.json cat electron/package.json

View File

@ -71,7 +71,7 @@ jobs:
jq --arg version "${{ inputs.new_version }}" '.version = $version' web/package.json > /tmp/package.json jq --arg version "${{ inputs.new_version }}" '.version = $version' web/package.json > /tmp/package.json
mv /tmp/package.json web/package.json mv /tmp/package.json web/package.json
jq '.build.publish = [{"provider": "s3", "bucket": "${{ secrets.CLOUDFLARE_R2_BUCKET_NAME }}", "region": "auto", "endpoint": "https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com", "path": "${{ inputs.cloudflare_r2_path }}", "channel": "latest"}]' electron/package.json > /tmp/package.json jq '.build.publish = [{"provider": "generic", "url": "${{ secrets.CLOUDFLARE_R2_PUBLIC_URL }}", "channel": "latest"}, {"provider": "s3", "bucket": "${{ secrets.CLOUDFLARE_R2_BUCKET_NAME }}", "region": "auto", "endpoint": "https://${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.r2.cloudflarestorage.com", "path": "${{ inputs.cloudflare_r2_path }}", "channel": "latest"}]' electron/package.json > /tmp/package.json
mv /tmp/package.json electron/package.json mv /tmp/package.json electron/package.json
jq '.build.win.sign = "./sign.js"' electron/package.json > /tmp/package.json jq '.build.win.sign = "./sign.js"' electron/package.json > /tmp/package.json

View File

@ -76,31 +76,31 @@ Jan is an open-source ChatGPT alternative that runs 100% offline on your compute
<tr style="text-align:center"> <tr style="text-align:center">
<td style="text-align:center"><b>Experimental (Nightly Build)</b></td> <td style="text-align:center"><b>Experimental (Nightly Build)</b></td>
<td style="text-align:center"> <td style="text-align:center">
<a href='https://delta.jan.ai/0.4.4-158/jan-win-x64-0.4.4-158.exe'> <a href='https://delta.jan.ai/latest/jan-win-x64-0.4.4-166.exe'>
<img src='./docs/static/img/windows.png' style="height:14px; width: 14px" /> <img src='./docs/static/img/windows.png' style="height:14px; width: 14px" />
<b>jan.exe</b> <b>jan.exe</b>
</a> </a>
</td> </td>
<td style="text-align:center"> <td style="text-align:center">
<a href='https://delta.jan.ai/0.4.4-158/jan-mac-x64-0.4.4-158.dmg'> <a href='https://delta.jan.ai/latest/jan-mac-x64-0.4.4-166.dmg'>
<img src='./docs/static/img/mac.png' style="height:15px; width: 15px" /> <img src='./docs/static/img/mac.png' style="height:15px; width: 15px" />
<b>Intel</b> <b>Intel</b>
</a> </a>
</td> </td>
<td style="text-align:center"> <td style="text-align:center">
<a href='https://delta.jan.ai/0.4.4-158/jan-mac-arm64-0.4.4-158.dmg'> <a href='https://delta.jan.ai/latest/jan-mac-arm64-0.4.4-166.dmg'>
<img src='./docs/static/img/mac.png' style="height:15px; width: 15px" /> <img src='./docs/static/img/mac.png' style="height:15px; width: 15px" />
<b>M1/M2</b> <b>M1/M2</b>
</a> </a>
</td> </td>
<td style="text-align:center"> <td style="text-align:center">
<a href='https://delta.jan.ai/0.4.4-158/jan-linux-amd64-0.4.4-158.deb'> <a href='https://delta.jan.ai/latest/jan-linux-amd64-0.4.4-166.deb'>
<img src='./docs/static/img/linux.png' style="height:14px; width: 14px" /> <img src='./docs/static/img/linux.png' style="height:14px; width: 14px" />
<b>jan.deb</b> <b>jan.deb</b>
</a> </a>
</td> </td>
<td style="text-align:center"> <td style="text-align:center">
<a href='https://delta.jan.ai/0.4.4-158/jan-linux-x86_64-0.4.4-158.AppImage'> <a href='https://delta.jan.ai/latest/jan-linux-x86_64-0.4.4-166.AppImage'>
<img src='./docs/static/img/linux.png' style="height:14px; width: 14px" /> <img src='./docs/static/img/linux.png' style="height:14px; width: 14px" />
<b>jan.AppImage</b> <b>jan.AppImage</b>
</a> </a>

View File

@ -0,0 +1,20 @@
---
title: Unexpected Token
slug: /troubleshooting/unexpected-token
description: Unexpected token is not a valid JSON
keywords:
[
Jan AI,
Jan,
ChatGPT alternative,
local AI,
private AI,
conversational AI,
no-subscription fee,
large language model,
troubleshooting,
unexpected token,
]
---
1. You may receive an error response `Error occurred: Unexpected token '<', "<!DOCTYPE"...is not valid JSON`, when you start a chat with OpenAI models. Using a VPN may help fix the issue.

View File

@ -14,7 +14,7 @@ license:
name: AGPLv3 name: AGPLv3
url: https://github.com/janhq/nitro/blob/main/LICENSE url: https://github.com/janhq/nitro/blob/main/LICENSE
servers: servers:
- url: http://localhost:1337/v1/ - url: /v1
tags: tags:
- name: Models - name: Models
description: List and describe the various models available in the API. description: List and describe the various models available in the API.
@ -642,4 +642,4 @@ x-webhooks:
content: content:
application/json: application/json:
schema: schema:
$ref: specs/threads.yaml#/components/schemas/ThreadObject $ref: specs/threads.yaml#/components/schemas/ThreadObject

View File

@ -72,7 +72,10 @@ export default class JanModelExtension extends ModelExtension {
* @param network - Optional object to specify proxy/whether to ignore SSL certificates. * @param network - Optional object to specify proxy/whether to ignore SSL certificates.
* @returns A Promise that resolves when the model is downloaded. * @returns A Promise that resolves when the model is downloaded.
*/ */
async downloadModel(model: Model, network?: { ignoreSSL?: boolean; proxy?: string }): Promise<void> { async downloadModel(
model: Model,
network?: { ignoreSSL?: boolean; proxy?: string }
): Promise<void> {
// create corresponding directory // create corresponding directory
const modelDirPath = await joinPath([JanModelExtension._homeDir, model.id]) const modelDirPath = await joinPath([JanModelExtension._homeDir, model.id])
if (!(await fs.existsSync(modelDirPath))) await fs.mkdirSync(modelDirPath) if (!(await fs.existsSync(modelDirPath))) await fs.mkdirSync(modelDirPath)
@ -294,6 +297,11 @@ export default class JanModelExtension extends ModelExtension {
name: dirName, name: dirName,
created: Date.now(), created: Date.now(),
description: `${dirName} - user self import model`, description: `${dirName} - user self import model`,
metadata: {
size: binaryFileSize,
author: 'User',
tags: [],
},
} }
const modelFilePath = await joinPath([ const modelFilePath = await joinPath([

View File

@ -9,7 +9,6 @@
"description": "User self import model", "description": "User self import model",
"settings": { "settings": {
"ctx_len": 4096, "ctx_len": 4096,
"ngl": 0,
"embedding": false, "embedding": false,
"prompt_template": "{system_message}\n### Instruction: {prompt}\n### Response:" "prompt_template": "{system_message}\n### Instruction: {prompt}\n### Response:"
}, },

View File

@ -116,7 +116,7 @@ export const startServer = async (configs?: ServerConfig) => {
// Log server listening // Log server listening
if (isVerbose) if (isVerbose)
logServer( logServer(
`Debug: JAN API listening at: http://${JAN_API_HOST}:${JAN_API_PORT}` `Debug: JAN API listening at: http://${hostSetting}:${portSetting}`
); );
}); });
} catch (e) { } catch (e) {

View File

@ -9,6 +9,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 { useActiveModel } from '@/hooks/useActiveModel'
import useSendChatMessage from '@/hooks/useSendChatMessage' import useSendChatMessage from '@/hooks/useSendChatMessage'
import { extensionManager } from '@/extension' import { extensionManager } from '@/extension'
@ -16,6 +17,7 @@ import {
deleteMessageAtom, deleteMessageAtom,
getCurrentChatMessagesAtom, getCurrentChatMessagesAtom,
} from '@/helpers/atoms/ChatMessage.atom' } from '@/helpers/atoms/ChatMessage.atom'
import { totalRamAtom } from '@/helpers/atoms/SystemBar.atom'
import { activeThreadAtom } from '@/helpers/atoms/Thread.atom' import { activeThreadAtom } from '@/helpers/atoms/Thread.atom'
const ErrorMessage = ({ message }: { message: ThreadMessage }) => { const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
@ -23,6 +25,8 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
const thread = useAtomValue(activeThreadAtom) const thread = useAtomValue(activeThreadAtom)
const deleteMessage = useSetAtom(deleteMessageAtom) const deleteMessage = useSetAtom(deleteMessageAtom)
const { resendChatMessage } = useSendChatMessage() const { resendChatMessage } = useSendChatMessage()
const { activeModel } = useActiveModel()
const totalRam = useAtomValue(totalRamAtom)
const regenerateMessage = async () => { const regenerateMessage = async () => {
const lastMessageIndex = messages.length - 1 const lastMessageIndex = messages.length - 1
@ -66,24 +70,33 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
{message.status === MessageStatus.Error && ( {message.status === MessageStatus.Error && (
<div key={message.id} className="mt-10 flex flex-col items-center"> <div key={message.id} className="mt-10 flex flex-col items-center">
<span className="mb-3 text-center text-sm font-medium text-gray-500"> <span className="mb-3 text-center text-sm font-medium text-gray-500">
<p>Apologies, something&apos;s amiss!</p> {Number(activeModel?.metadata.size) > totalRam ? (
Jan&apos;s in beta. Find troubleshooting guides{' '} <>
<a Oops! Model size exceeds available RAM. Consider selecting a
href="https://jan.ai/guides/troubleshooting" smaller model or upgrading your RAM for smoother performance.
target="_blank" </>
className="text-blue-600 hover:underline dark:text-blue-300" ) : (
> <>
here <p>Apologies, something&apos;s amiss!</p>
</a>{' '} Jan&apos;s in beta. Find troubleshooting guides{' '}
or reach out to us on{' '} <a
<a href="https://jan.ai/guides/troubleshooting"
href="https://discord.gg/AsJ8krTT3N" target="_blank"
target="_blank" className="text-blue-600 hover:underline dark:text-blue-300"
className="text-blue-600 hover:underline dark:text-blue-300" >
> here
Discord </a>{' '}
</a>{' '} or reach out to us on{' '}
for assistance. <a
href="https://discord.gg/AsJ8krTT3N"
target="_blank"
className="text-blue-600 hover:underline dark:text-blue-300"
>
Discord
</a>{' '}
for assistance.
</>
)}
</span> </span>
</div> </div>
)} )}

View File

@ -108,9 +108,7 @@ const LocalServerScreen = () => {
window.core?.api?.stopServer() window.core?.api?.stopServer()
setServerEnabled(false) setServerEnabled(false)
} else { } else {
if (!activeModel) { startModel(String(selectedModel?.id))
startModel(String(selectedModel?.id))
}
window.core?.api?.startServer({ window.core?.api?.startServer({
host, host,
port, port,
@ -129,7 +127,7 @@ const LocalServerScreen = () => {
</Button> </Button>
{serverEnabled && ( {serverEnabled && (
<Button block themes="secondaryBlue" asChild> <Button block themes="secondaryBlue" asChild>
<a href={`http://${host}:${port}`} target="_blank"> <a href={`http://localhost:${port}`} target="_blank">
API Reference <ExternalLinkIcon size={20} className="ml-2" /> API Reference <ExternalLinkIcon size={20} className="ml-2" />
</a> </a>
</Button> </Button>