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

Release/0.4.13 to main #2916

Merged
merged 27 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
012cc80
Merge pull request #2815 from janhq/main
Van-QA Apr 25, 2024
0bad1a4
fix: remove scroll animation chat screen (#2819)
namchuai Apr 25, 2024
ce2d8e5
chore: remove nutjs (#2860)
namchuai May 2, 2024
c6182ab
Customize scroll-bar style (#2857)
QuentinMacheda May 3, 2024
2016eae
Remove hidden overflow property of tailwind + Update buttons position…
QuentinMacheda May 3, 2024
c21bc08
Fix eslint issue in EditChatInput (#2864)
QuentinMacheda May 3, 2024
092a572
Feat: Remote API Parameters Correction (#2802)
hahuyhoang411 May 4, 2024
4c88d03
feat: add remote model command-r (#2868)
henryh0x1 May 6, 2024
86fda1c
feat: add model gpt-4 turbo (#2836)
henryh0x1 May 6, 2024
a6ccd67
fix: validate max_token from context_length value (#2870)
urmauur May 6, 2024
1e3e5a8
feat/implement-inference-martian-extension (#2869)
henryh0x1 May 6, 2024
9effb6a
fix: validate context length (#2871)
urmauur May 6, 2024
d226640
Add OpenRouter (#2826)
Inchoker May 6, 2024
2008aae
Feat: Correct context length for models (#2867)
hahuyhoang411 May 6, 2024
0406b51
fix: stop auto scroll if user manually scrolling up (#2874)
namchuai May 6, 2024
efbc96d
feat: inference anthropic extension (#2885)
henryh0x1 May 11, 2024
6af4a2d
feat: add deeplink support (#2883)
namchuai May 13, 2024
1e0d4f3
Feat: Adjust model hub v0.4.13 (#2879)
hahuyhoang411 May 13, 2024
08d15e5
fix: deeplink when app not open on linux (#2893)
namchuai May 13, 2024
eb7e963
add: gpt4o (#2899)
hahuyhoang411 May 14, 2024
aa1f01f
Revert "chore: remove nutjs" and replace nutjs version (#2900)
Van-QA May 15, 2024
1130979
fix: cohere stream param does not work (#2907)
louis-jan May 15, 2024
33697be
Change mac arm64 build use github runner (#2910)
hiento09 May 16, 2024
06be308
Revert "Change mac arm64 build use github runner (#2910)" (#2911)
hiento09 May 16, 2024
0436224
Revert "Revert "Change mac arm64 build use github runner (#2910)" (#2…
hiento09 May 16, 2024
2182599
Chore: Add phi3 (#2914)
hahuyhoang411 May 16, 2024
537ef20
chore: replace nitro by cortex-cpp (#2912)
louis-jan May 16, 2024
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
112 changes: 56 additions & 56 deletions .github/workflows/jan-electron-linter-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ jobs:
rm -rf ~/jan
make clean

# - name: Get Commit Message for PR
# if : github.event_name == 'pull_request'
# run: |
# echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}})" >> $GITHUB_ENV
- name: Get Commit Message for PR
if : github.event_name == 'pull_request'
run: |
echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}})" >> $GITHUB_ENV

# - name: Get Commit Message for push event
# if : github.event_name == 'push'
# run: |
# echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}})" >> $GITHUB_ENV
- name: Get Commit Message for push event
if : github.event_name == 'push'
run: |
echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}})" >> $GITHUB_ENV

# - name: "Config report portal"
# run: |
# make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App macos" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"
- name: "Config report portal"
run: |
make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App macos" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"

- name: Linter and test
run: |
Expand All @@ -78,9 +78,9 @@ jobs:
make test
env:
CSC_IDENTITY_AUTO_DISCOVERY: "false"
# TURBO_API: "${{ secrets.TURBO_API }}"
# TURBO_TEAM: "macos"
# TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"
TURBO_API: "${{ secrets.TURBO_API }}"
TURBO_TEAM: "macos"
TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"

test-on-macos-pr-target:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
Expand Down Expand Up @@ -141,27 +141,27 @@ jobs:
}
make clean

# - name: Get Commit Message for push event
# if : github.event_name == 'push'
# shell: bash
# run: |
# echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}}" >> $GITHUB_ENV
- name: Get Commit Message for push event
if : github.event_name == 'push'
shell: bash
run: |
echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}}" >> $GITHUB_ENV

# - name: "Config report portal"
# shell: bash
# run: |
# make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Windows ${{ matrix.antivirus-tools }}" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"
- name: "Config report portal"
shell: bash
run: |
make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Windows ${{ matrix.antivirus-tools }}" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"

- name: Linter and test
shell: powershell
run: |
npm config set registry ${{ secrets.NPM_PROXY }} --global
yarn config set registry ${{ secrets.NPM_PROXY }} --global
make test
# env:
# TURBO_API: "${{ secrets.TURBO_API }}"
# TURBO_TEAM: "windows"
# TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"
env:
TURBO_API: "${{ secrets.TURBO_API }}"
TURBO_TEAM: "windows"
TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"
test-on-windows-pr:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: windows-desktop-default-windows-security
Expand Down Expand Up @@ -189,27 +189,27 @@ jobs:
}
make clean

# - name: Get Commit Message for PR
# if : github.event_name == 'pull_request'
# shell: bash
# run: |
# echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}}" >> $GITHUB_ENV
- name: Get Commit Message for PR
if : github.event_name == 'pull_request'
shell: bash
run: |
echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}}" >> $GITHUB_ENV

# - name: "Config report portal"
# shell: bash
# run: |
# make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Windows" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"
- name: "Config report portal"
shell: bash
run: |
make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Windows" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"

- name: Linter and test
shell: powershell
run: |
npm config set registry ${{ secrets.NPM_PROXY }} --global
yarn config set registry ${{ secrets.NPM_PROXY }} --global
make test
# env:
# TURBO_API: "${{ secrets.TURBO_API }}"
# TURBO_TEAM: "windows"
# TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"
env:
TURBO_API: "${{ secrets.TURBO_API }}"
TURBO_TEAM: "windows"
TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"

test-on-windows-pr-target:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
Expand Down Expand Up @@ -266,20 +266,20 @@ jobs:
rm -rf ~/jan
make clean

# - name: Get Commit Message for PR
# if : github.event_name == 'pull_request'
# run: |
# echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}}" >> $GITHUB_ENV
- name: Get Commit Message for PR
if : github.event_name == 'pull_request'
run: |
echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}}" >> $GITHUB_ENV

# - name: Get Commit Message for push event
# if : github.event_name == 'push'
# run: |
# echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}}" >> $GITHUB_ENV
- name: Get Commit Message for push event
if : github.event_name == 'push'
run: |
echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}}" >> $GITHUB_ENV

# - name: "Config report portal"
# shell: bash
# run: |
# make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Linux" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"
- name: "Config report portal"
shell: bash
run: |
make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Linux" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}"

- name: Linter and test
run: |
Expand All @@ -288,10 +288,10 @@ jobs:
npm config set registry ${{ secrets.NPM_PROXY }} --global
yarn config set registry ${{ secrets.NPM_PROXY }} --global
make test
# env:
# TURBO_API: "${{ secrets.TURBO_API }}"
# TURBO_TEAM: "linux"
# TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"
env:
TURBO_API: "${{ secrets.TURBO_API }}"
TURBO_TEAM: "linux"
TURBO_TOKEN: "${{ secrets.TURBO_TOKEN }}"

test-on-ubuntu-pr-target:
runs-on: [self-hosted, Linux, ubuntu-desktop]
Expand Down
44 changes: 19 additions & 25 deletions .github/workflows/template-build-macos-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ on:

jobs:
build-macos:
runs-on: macos-silicon
runs-on: macos-latest
environment: production
permissions:
contents: write
Expand All @@ -55,15 +55,9 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 20
- name: Unblock keychain
run: |
security unlock-keychain -p ${{ secrets.KEYCHAIN_PASSWORD }} ~/Library/Keychains/login.keychain-db
# - uses: actions/setup-python@v5
# with:
# python-version: '3.11'

# - name: Install jq
# uses: dcarbone/install-jq-action@v2.0.1
- name: Install jq
uses: dcarbone/install-jq-action@v2.0.1

- name: Update app version based on latest release tag with build number
if: inputs.public_provider != 'github'
Expand Down Expand Up @@ -101,17 +95,17 @@ jobs:
env:
VERSION_TAG: ${{ inputs.new_version }}

# - name: Get Cer for code signing
# run: base64 -d <<< "$CODE_SIGN_P12_BASE64" > /tmp/codesign.p12
# shell: bash
# env:
# CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
- name: Get Cer for code signing
run: base64 -d <<< "$CODE_SIGN_P12_BASE64" > /tmp/codesign.p12
shell: bash
env:
CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }}

# - uses: apple-actions/import-codesign-certs@v2
# continue-on-error: true
# with:
# p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
# p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
- uses: apple-actions/import-codesign-certs@v2
continue-on-error: true
with:
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}

- name: Build and publish app to cloudflare r2 or github artifactory
if: inputs.public_provider != 'github'
Expand All @@ -125,9 +119,9 @@ jobs:
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CSC_LINK: "/tmp/codesign.p12"
# CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
# CSC_IDENTITY_AUTO_DISCOVERY: "true"
CSC_LINK: "/tmp/codesign.p12"
CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
CSC_IDENTITY_AUTO_DISCOVERY: "true"
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APP_PATH: "."
Expand All @@ -143,9 +137,9 @@ jobs:
make build-and-publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CSC_LINK: "/tmp/codesign.p12"
# CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
# CSC_IDENTITY_AUTO_DISCOVERY: "true"
CSC_LINK: "/tmp/codesign.p12"
CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
CSC_IDENTITY_AUTO_DISCOVERY: "true"
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APP_PATH: "."
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/template-build-macos-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: latest-mac-x64
path: ./electron/dist/latest-mac.yml

path: ./electron/dist/latest-mac.yml
19 changes: 12 additions & 7 deletions core/src/browser/extensions/engines/helpers/sse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,19 @@ export function requestInference(
let cachedLines = ''
for (const line of lines) {
try {
const toParse = cachedLines + line
if (!line.includes('data: [DONE]')) {
const data = JSON.parse(toParse.replace('data: ', ''))
content += data.choices[0]?.delta?.content ?? ''
if (content.startsWith('assistant: ')) {
content = content.replace('assistant: ', '')
if (transformResponse) {
content += transformResponse(line)
subscriber.next(content ?? '')
} else {
const toParse = cachedLines + line
if (!line.includes('data: [DONE]')) {
const data = JSON.parse(toParse.replace('data: ', ''))
content += data.choices[0]?.delta?.content ?? ''
if (content.startsWith('assistant: ')) {
content = content.replace('assistant: ', '')
}
if (content !== '') subscriber.next(content)
}
if (content !== '') subscriber.next(content)
}
} catch {
cachedLines = line
Expand Down
6 changes: 3 additions & 3 deletions core/src/node/api/restful/helper/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export const SUPPORTED_MODEL_FORMAT = '.gguf'
// The URL for the Nitro subprocess
const NITRO_HTTP_SERVER_URL = `http://${LOCAL_HOST}:${NITRO_DEFAULT_PORT}`
// The URL for the Nitro subprocess to load a model
export const NITRO_HTTP_LOAD_MODEL_URL = `${NITRO_HTTP_SERVER_URL}/inferences/llamacpp/loadmodel`
export const NITRO_HTTP_LOAD_MODEL_URL = `${NITRO_HTTP_SERVER_URL}/inferences/server/loadmodel`
// The URL for the Nitro subprocess to validate a model
export const NITRO_HTTP_VALIDATE_MODEL_URL = `${NITRO_HTTP_SERVER_URL}/inferences/llamacpp/modelstatus`
export const NITRO_HTTP_VALIDATE_MODEL_URL = `${NITRO_HTTP_SERVER_URL}/inferences/server/modelstatus`

// The URL for the Nitro subprocess to kill itself
export const NITRO_HTTP_KILL_URL = `${NITRO_HTTP_SERVER_URL}/processmanager/destroy`

export const DEFAULT_CHAT_COMPLETION_URL = `http://${LOCAL_HOST}:${NITRO_DEFAULT_PORT}/inferences/llamacpp/chat_completion` // default nitro url
export const DEFAULT_CHAT_COMPLETION_URL = `http://${LOCAL_HOST}:${NITRO_DEFAULT_PORT}/inferences/server/chat_completion` // default nitro url
26 changes: 15 additions & 11 deletions core/src/node/api/restful/helper/startStopModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ const runNitroAndLoadModel = async (modelId: string, modelSettings: NitroModelSe
}

const spawnNitroProcess = async (): Promise<void> => {
log(`[SERVER]::Debug: Spawning Nitro subprocess...`)
log(`[SERVER]::Debug: Spawning cortex subprocess...`)

let binaryFolder = join(
getJanExtensionsPath(),
'@janhq',
'inference-nitro-extension',
'inference-cortex-extension',
'dist',
'bin'
)
Expand All @@ -160,7 +160,7 @@ const spawnNitroProcess = async (): Promise<void> => {
const args: string[] = ['1', LOCAL_HOST, NITRO_DEFAULT_PORT.toString()]
// Execute the binary
log(
`[SERVER]::Debug: Spawn nitro at path: ${executableOptions.executablePath}, and args: ${args}`
`[SERVER]::Debug: Spawn cortex at path: ${executableOptions.executablePath}, and args: ${args}`
)
subprocess = spawn(
executableOptions.executablePath,
Expand All @@ -184,12 +184,12 @@ const spawnNitroProcess = async (): Promise<void> => {
})

subprocess.on('close', (code: any) => {
log(`[SERVER]::Debug: Nitro exited with code: ${code}`)
log(`[SERVER]::Debug: cortex exited with code: ${code}`)
subprocess = undefined
})

tcpPortUsed.waitUntilUsed(NITRO_DEFAULT_PORT, 300, 30000).then(() => {
log(`[SERVER]::Debug: Nitro is ready`)
log(`[SERVER]::Debug: cortex is ready`)
})
}

Expand All @@ -203,13 +203,13 @@ const executableNitroFile = (): NitroExecutableOptions => {
let binaryFolder = join(
getJanExtensionsPath(),
'@janhq',
'inference-nitro-extension',
'inference-cortex-extension',
'dist',
'bin'
)

let cudaVisibleDevices = ''
let binaryName = 'nitro'
let binaryName = 'cortex-cpp'
/**
* The binary folder is different for each platform.
*/
Expand All @@ -228,12 +228,16 @@ const executableNitroFile = (): NitroExecutableOptions => {
}
cudaVisibleDevices = nvidiaInfo['gpu_highest_vram']
}
binaryName = 'nitro.exe'
binaryName = 'cortex-cpp.exe'
} else if (process.platform === 'darwin') {
/**
* For MacOS: mac-universal both Silicon and InteL
*/
binaryFolder = join(binaryFolder, 'mac-universal')
if(process.arch === 'arm64') {
binaryFolder = join(binaryFolder, 'mac-arm64')
} else {
binaryFolder = join(binaryFolder, 'mac-amd64')
}
} else {
/**
* For Linux: linux-cpu, linux-cuda-11-7, linux-cuda-12-0
Expand Down Expand Up @@ -300,7 +304,7 @@ const loadLLMModel = async (settings: NitroModelSettings): Promise<Response> =>
retryDelay: 500,
})
.then((res: any) => {
log(`[SERVER]::Debug: Load model success with response ${JSON.stringify(res)}`)
log(`[SERVER]::Debug: Load model request with response ${JSON.stringify(res)}`)
return Promise.resolve(res)
})
.catch((err: any) => {
Expand All @@ -327,7 +331,7 @@ export const stopModel = async (_modelId: string) => {
})
}, 5000)
const tcpPortUsed = require('tcp-port-used')
log(`[SERVER]::Debug: Request to kill Nitro`)
log(`[SERVER]::Debug: Request to kill cortex`)

fetch(NITRO_HTTP_KILL_URL, {
method: 'DELETE',
Expand Down
Loading
Loading