Merge pull request #6756 from menloresearch/sync/release-7-1-into-dev
Sync release 0.7.1 to dev
This commit is contained in:
commit
e7fcc809e7
@ -49,6 +49,8 @@ jobs:
|
|||||||
# Update tauri.conf.json
|
# Update tauri.conf.json
|
||||||
jq --arg version "${{ inputs.new_version }}" '.version = $version | .bundle.createUpdaterArtifacts = false' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
jq --arg version "${{ inputs.new_version }}" '.version = $version | .bundle.createUpdaterArtifacts = false' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
||||||
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
||||||
|
jq '.bundle.windows.nsis.template = "tauri.bundle.windows.nsis.template"' ./src-tauri/tauri.windows.conf.json > /tmp/tauri.windows.conf.json
|
||||||
|
mv /tmp/tauri.windows.conf.json ./src-tauri/tauri.windows.conf.json
|
||||||
jq '.bundle.windows.signCommand = "echo External build - skipping signature: %1"' ./src-tauri/tauri.windows.conf.json > /tmp/tauri.windows.conf.json
|
jq '.bundle.windows.signCommand = "echo External build - skipping signature: %1"' ./src-tauri/tauri.windows.conf.json > /tmp/tauri.windows.conf.json
|
||||||
mv /tmp/tauri.windows.conf.json ./src-tauri/tauri.windows.conf.json
|
mv /tmp/tauri.windows.conf.json ./src-tauri/tauri.windows.conf.json
|
||||||
jq --arg version "${{ inputs.new_version }}" '.version = $version' web-app/package.json > /tmp/package.json
|
jq --arg version "${{ inputs.new_version }}" '.version = $version' web-app/package.json > /tmp/package.json
|
||||||
@ -80,6 +82,36 @@ jobs:
|
|||||||
echo "---------./src-tauri/Cargo.toml---------"
|
echo "---------./src-tauri/Cargo.toml---------"
|
||||||
cat ./src-tauri/Cargo.toml
|
cat ./src-tauri/Cargo.toml
|
||||||
|
|
||||||
|
generate_build_version() {
|
||||||
|
### Examble
|
||||||
|
### input 0.5.6 output will be 0.5.6 and 0.5.6.0
|
||||||
|
### input 0.5.6-rc2-beta output will be 0.5.6 and 0.5.6.2
|
||||||
|
### input 0.5.6-1213 output will be 0.5.6 and and 0.5.6.1213
|
||||||
|
local new_version="$1"
|
||||||
|
local base_version
|
||||||
|
local t_value
|
||||||
|
# Check if it has a "-"
|
||||||
|
if [[ "$new_version" == *-* ]]; then
|
||||||
|
base_version="${new_version%%-*}" # part before -
|
||||||
|
suffix="${new_version#*-}" # part after -
|
||||||
|
# Check if it is rcX-beta
|
||||||
|
if [[ "$suffix" =~ ^rc([0-9]+)-beta$ ]]; then
|
||||||
|
t_value="${BASH_REMATCH[1]}"
|
||||||
|
else
|
||||||
|
t_value="$suffix"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
base_version="$new_version"
|
||||||
|
t_value="0"
|
||||||
|
fi
|
||||||
|
# Export two values
|
||||||
|
new_base_version="$base_version"
|
||||||
|
new_build_version="${base_version}.${t_value}"
|
||||||
|
}
|
||||||
|
generate_build_version ${{ inputs.new_version }}
|
||||||
|
sed -i "s/jan_version/$new_base_version/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
sed -i "s/jan_build/$new_build_version/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
|
||||||
if [ "${{ inputs.channel }}" != "stable" ]; then
|
if [ "${{ inputs.channel }}" != "stable" ]; then
|
||||||
jq '.plugins.updater.endpoints = ["https://delta.jan.ai/${{ inputs.channel }}/latest.json"]' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
jq '.plugins.updater.endpoints = ["https://delta.jan.ai/${{ inputs.channel }}/latest.json"]' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
||||||
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
||||||
@ -103,7 +135,14 @@ jobs:
|
|||||||
chmod +x .github/scripts/rename-workspace.sh
|
chmod +x .github/scripts/rename-workspace.sh
|
||||||
.github/scripts/rename-workspace.sh ./package.json ${{ inputs.channel }}
|
.github/scripts/rename-workspace.sh ./package.json ${{ inputs.channel }}
|
||||||
cat ./package.json
|
cat ./package.json
|
||||||
|
sed -i "s/jan_productname/Jan-${{ inputs.channel }}/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
sed -i "s/jan_mainbinaryname/jan-${{ inputs.channel }}/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
else
|
||||||
|
sed -i "s/jan_productname/Jan/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
sed -i "s/jan_mainbinaryname/jan/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
fi
|
fi
|
||||||
|
echo "---------nsis.template---------"
|
||||||
|
cat ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
- name: Build app
|
- name: Build app
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@ -98,9 +98,15 @@ jobs:
|
|||||||
# Update tauri.conf.json
|
# Update tauri.conf.json
|
||||||
jq --arg version "${{ inputs.new_version }}" '.version = $version | .bundle.createUpdaterArtifacts = true' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
jq --arg version "${{ inputs.new_version }}" '.version = $version | .bundle.createUpdaterArtifacts = true' ./src-tauri/tauri.conf.json > /tmp/tauri.conf.json
|
||||||
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
mv /tmp/tauri.conf.json ./src-tauri/tauri.conf.json
|
||||||
|
jq '.bundle.windows.nsis.template = "tauri.bundle.windows.nsis.template"' ./src-tauri/tauri.windows.conf.json > /tmp/tauri.windows.conf.json
|
||||||
|
mv /tmp/tauri.windows.conf.json ./src-tauri/tauri.windows.conf.json
|
||||||
jq --arg version "${{ inputs.new_version }}" '.version = $version' web-app/package.json > /tmp/package.json
|
jq --arg version "${{ inputs.new_version }}" '.version = $version' web-app/package.json > /tmp/package.json
|
||||||
mv /tmp/package.json web-app/package.json
|
mv /tmp/package.json web-app/package.json
|
||||||
|
|
||||||
|
# Add sign commands to tauri.windows.conf.json
|
||||||
|
jq '.bundle.windows.signCommand = "powershell -ExecutionPolicy Bypass -File ./sign.ps1 %1"' ./src-tauri/tauri.windows.conf.json > /tmp/tauri.windows.conf.json
|
||||||
|
mv /tmp/tauri.windows.conf.json ./src-tauri/tauri.windows.conf.json
|
||||||
|
|
||||||
# Update tauri plugin versions
|
# Update tauri plugin versions
|
||||||
|
|
||||||
jq --arg version "${{ inputs.new_version }}" '.version = $version' ./src-tauri/plugins/tauri-plugin-hardware/package.json > /tmp/package.json
|
jq --arg version "${{ inputs.new_version }}" '.version = $version' ./src-tauri/plugins/tauri-plugin-hardware/package.json > /tmp/package.json
|
||||||
@ -127,9 +133,35 @@ jobs:
|
|||||||
echo "---------./src-tauri/Cargo.toml---------"
|
echo "---------./src-tauri/Cargo.toml---------"
|
||||||
cat ./src-tauri/Cargo.toml
|
cat ./src-tauri/Cargo.toml
|
||||||
|
|
||||||
# Add sign commands to tauri.windows.conf.json
|
generate_build_version() {
|
||||||
jq '.bundle.windows.signCommand = "powershell -ExecutionPolicy Bypass -File ./sign.ps1 %1"' ./src-tauri/tauri.windows.conf.json > /tmp/tauri.windows.conf.json
|
### Example
|
||||||
mv /tmp/tauri.windows.conf.json ./src-tauri/tauri.windows.conf.json
|
### input 0.5.6 output will be 0.5.6 and 0.5.6.0
|
||||||
|
### input 0.5.6-rc2-beta output will be 0.5.6 and 0.5.6.2
|
||||||
|
### input 0.5.6-1213 output will be 0.5.6 and and 0.5.6.1213
|
||||||
|
local new_version="$1"
|
||||||
|
local base_version
|
||||||
|
local t_value
|
||||||
|
# Check if it has a "-"
|
||||||
|
if [[ "$new_version" == *-* ]]; then
|
||||||
|
base_version="${new_version%%-*}" # part before -
|
||||||
|
suffix="${new_version#*-}" # part after -
|
||||||
|
# Check if it is rcX-beta
|
||||||
|
if [[ "$suffix" =~ ^rc([0-9]+)-beta$ ]]; then
|
||||||
|
t_value="${BASH_REMATCH[1]}"
|
||||||
|
else
|
||||||
|
t_value="$suffix"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
base_version="$new_version"
|
||||||
|
t_value="0"
|
||||||
|
fi
|
||||||
|
# Export two values
|
||||||
|
new_base_version="$base_version"
|
||||||
|
new_build_version="${base_version}.${t_value}"
|
||||||
|
}
|
||||||
|
generate_build_version ${{ inputs.new_version }}
|
||||||
|
sed -i "s/jan_version/$new_base_version/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
sed -i "s/jan_build/$new_build_version/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
|
||||||
echo "---------tauri.windows.conf.json---------"
|
echo "---------tauri.windows.conf.json---------"
|
||||||
cat ./src-tauri/tauri.windows.conf.json
|
cat ./src-tauri/tauri.windows.conf.json
|
||||||
@ -163,7 +195,14 @@ jobs:
|
|||||||
chmod +x .github/scripts/rename-workspace.sh
|
chmod +x .github/scripts/rename-workspace.sh
|
||||||
.github/scripts/rename-workspace.sh ./package.json ${{ inputs.channel }}
|
.github/scripts/rename-workspace.sh ./package.json ${{ inputs.channel }}
|
||||||
cat ./package.json
|
cat ./package.json
|
||||||
|
sed -i "s/jan_productname/Jan-${{ inputs.channel }}/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
sed -i "s/jan_mainbinaryname/jan-${{ inputs.channel }}/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
else
|
||||||
|
sed -i "s/jan_productname/Jan/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
sed -i "s/jan_mainbinaryname/jan/g" ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
fi
|
fi
|
||||||
|
echo "---------nsis.template---------"
|
||||||
|
cat ./src-tauri/tauri.bundle.windows.nsis.template
|
||||||
|
|
||||||
- name: Install AzureSignTool
|
- name: Install AzureSignTool
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
1
Makefile
1
Makefile
@ -117,7 +117,6 @@ lint: install-and-build
|
|||||||
test: lint
|
test: lint
|
||||||
yarn download:bin
|
yarn download:bin
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
yarn download:windows-installer
|
|
||||||
endif
|
endif
|
||||||
yarn test
|
yarn test
|
||||||
yarn copy:assets:tauri
|
yarn copy:assets:tauri
|
||||||
|
|||||||
@ -332,12 +332,14 @@ export default class llamacpp_extension extends AIEngine {
|
|||||||
)
|
)
|
||||||
// Clear the invalid stored preference
|
// Clear the invalid stored preference
|
||||||
this.clearStoredBackendType()
|
this.clearStoredBackendType()
|
||||||
bestAvailableBackendString =
|
bestAvailableBackendString = await this.determineBestBackend(
|
||||||
await this.determineBestBackend(version_backends)
|
version_backends
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bestAvailableBackendString =
|
bestAvailableBackendString = await this.determineBestBackend(
|
||||||
await this.determineBestBackend(version_backends)
|
version_backends
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
let settings = structuredClone(SETTINGS)
|
let settings = structuredClone(SETTINGS)
|
||||||
@ -2151,7 +2153,12 @@ export default class llamacpp_extension extends AIEngine {
|
|||||||
if (mmprojPath && !this.isAbsolutePath(mmprojPath))
|
if (mmprojPath && !this.isAbsolutePath(mmprojPath))
|
||||||
mmprojPath = await joinPath([await getJanDataFolderPath(), path])
|
mmprojPath = await joinPath([await getJanDataFolderPath(), path])
|
||||||
try {
|
try {
|
||||||
const result = await planModelLoadInternal(path, this.memoryMode, mmprojPath, requestedCtx)
|
const result = await planModelLoadInternal(
|
||||||
|
path,
|
||||||
|
this.memoryMode,
|
||||||
|
mmprojPath,
|
||||||
|
requestedCtx
|
||||||
|
)
|
||||||
return result
|
return result
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(String(e))
|
throw new Error(String(e))
|
||||||
@ -2279,12 +2286,18 @@ export default class llamacpp_extension extends AIEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate text tokens
|
// Calculate text tokens
|
||||||
const messages = JSON.stringify({ messages: opts.messages })
|
// Use chat_template_kwargs from opts if provided, otherwise default to disable enable_thinking
|
||||||
|
const tokenizeRequest = {
|
||||||
|
messages: opts.messages,
|
||||||
|
chat_template_kwargs: opts.chat_template_kwargs || {
|
||||||
|
enable_thinking: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
let parseResponse = await fetch(`${baseUrl}/apply-template`, {
|
let parseResponse = await fetch(`${baseUrl}/apply-template`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: headers,
|
headers: headers,
|
||||||
body: messages,
|
body: JSON.stringify(tokenizeRequest),
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!parseResponse.ok) {
|
if (!parseResponse.ok) {
|
||||||
|
|||||||
@ -35,8 +35,7 @@
|
|||||||
"copy:assets:mobile": "cpx \"pre-install/*.tgz\" \"src-tauri/resources/pre-install/\" && cpx \"LICENSE\" \"src-tauri/resources/\"",
|
"copy:assets:mobile": "cpx \"pre-install/*.tgz\" \"src-tauri/resources/pre-install/\" && cpx \"LICENSE\" \"src-tauri/resources/\"",
|
||||||
"download:lib": "node ./scripts/download-lib.mjs",
|
"download:lib": "node ./scripts/download-lib.mjs",
|
||||||
"download:bin": "node ./scripts/download-bin.mjs",
|
"download:bin": "node ./scripts/download-bin.mjs",
|
||||||
"download:windows-installer": "node ./scripts/download-win-installer-deps.mjs",
|
"build:tauri:win32": "yarn download:bin && yarn tauri build",
|
||||||
"build:tauri:win32": "yarn download:bin && yarn download:windows-installer && yarn tauri build",
|
|
||||||
"build:tauri:linux": "yarn download:bin && NO_STRIP=1 ./src-tauri/build-utils/shim-linuxdeploy.sh yarn tauri build && ./src-tauri/build-utils/buildAppImage.sh",
|
"build:tauri:linux": "yarn download:bin && NO_STRIP=1 ./src-tauri/build-utils/shim-linuxdeploy.sh yarn tauri build && ./src-tauri/build-utils/buildAppImage.sh",
|
||||||
"build:tauri:darwin": "yarn download:bin && yarn tauri build --target universal-apple-darwin",
|
"build:tauri:darwin": "yarn download:bin && yarn tauri build --target universal-apple-darwin",
|
||||||
"build:tauri": "yarn build:icon && yarn copy:assets:tauri && run-script-os",
|
"build:tauri": "yarn build:icon && yarn copy:assets:tauri && run-script-os",
|
||||||
|
|||||||
@ -1,83 +0,0 @@
|
|||||||
console.log('Downloading Windows installer dependencies...')
|
|
||||||
// scripts/download-win-installer-deps.mjs
|
|
||||||
import https from 'https'
|
|
||||||
import fs, { mkdirSync } from 'fs'
|
|
||||||
import os from 'os'
|
|
||||||
import path from 'path'
|
|
||||||
import { copySync } from 'cpx'
|
|
||||||
|
|
||||||
function download(url, dest) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
console.log(`Downloading ${url} to ${dest}`)
|
|
||||||
const file = fs.createWriteStream(dest)
|
|
||||||
https
|
|
||||||
.get(url, (response) => {
|
|
||||||
console.log(`Response status code: ${response.statusCode}`)
|
|
||||||
if (
|
|
||||||
response.statusCode >= 300 &&
|
|
||||||
response.statusCode < 400 &&
|
|
||||||
response.headers.location
|
|
||||||
) {
|
|
||||||
// Handle redirect
|
|
||||||
const redirectURL = response.headers.location
|
|
||||||
console.log(`Redirecting to ${redirectURL}`)
|
|
||||||
download(redirectURL, dest).then(resolve, reject) // Recursive call
|
|
||||||
return
|
|
||||||
} else if (response.statusCode !== 200) {
|
|
||||||
reject(`Failed to get '${url}' (${response.statusCode})`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
response.pipe(file)
|
|
||||||
file.on('finish', () => {
|
|
||||||
file.close(resolve)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.on('error', (err) => {
|
|
||||||
fs.unlink(dest, () => reject(err.message))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
console.log('Starting Windows installer dependencies download')
|
|
||||||
const platform = os.platform() // 'darwin', 'linux', 'win32'
|
|
||||||
const arch = os.arch() // 'x64', 'arm64', etc.
|
|
||||||
|
|
||||||
if (arch != 'x64') return
|
|
||||||
|
|
||||||
|
|
||||||
const libDir = 'src-tauri/resources/lib'
|
|
||||||
const tempDir = 'scripts/dist'
|
|
||||||
|
|
||||||
try {
|
|
||||||
mkdirSync('scripts/dist')
|
|
||||||
} catch (err) {
|
|
||||||
// Expect EEXIST error if the directory already exists
|
|
||||||
}
|
|
||||||
|
|
||||||
// Download VC++ Redistributable 17
|
|
||||||
if (platform == 'win32') {
|
|
||||||
const vcFilename = 'vc_redist.x64.exe'
|
|
||||||
const vcUrl = 'https://aka.ms/vs/17/release/vc_redist.x64.exe'
|
|
||||||
|
|
||||||
console.log(`Downloading VC++ Redistributable...`)
|
|
||||||
const vcSavePath = path.join(tempDir, vcFilename)
|
|
||||||
if (!fs.existsSync(vcSavePath)) {
|
|
||||||
await download(vcUrl, vcSavePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy to tauri resources
|
|
||||||
try {
|
|
||||||
copySync(vcSavePath, libDir)
|
|
||||||
} catch (err) {
|
|
||||||
// Expect EEXIST error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Windows installer dependencies downloads completed.')
|
|
||||||
}
|
|
||||||
|
|
||||||
main().catch((err) => {
|
|
||||||
console.error('Error:', err)
|
|
||||||
process.exit(1)
|
|
||||||
})
|
|
||||||
1006
src-tauri/tauri.bundle.windows.nsis.template
Normal file
1006
src-tauri/tauri.bundle.windows.nsis.template
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,18 +11,13 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"targets": ["nsis"],
|
"targets": ["nsis", "msi"],
|
||||||
"resources": [
|
"resources": [
|
||||||
"resources/pre-install/**/*",
|
"resources/pre-install/**/*",
|
||||||
"resources/lib/vc_redist.x64.exe",
|
|
||||||
"resources/LICENSE"
|
"resources/LICENSE"
|
||||||
],
|
],
|
||||||
"externalBin": ["resources/bin/bun", "resources/bin/uv"],
|
"externalBin": ["resources/bin/bun", "resources/bin/uv"],
|
||||||
"windows": {
|
"windows": {
|
||||||
"nsis": {
|
|
||||||
"installerHooks": "./windows/hooks.nsh",
|
|
||||||
"installerIcon": "icons/icon.ico"
|
|
||||||
},
|
|
||||||
"webviewInstallMode": {
|
"webviewInstallMode": {
|
||||||
"silent": true,
|
"silent": true,
|
||||||
"type": "downloadBootstrapper"
|
"type": "downloadBootstrapper"
|
||||||
|
|||||||
@ -1,65 +0,0 @@
|
|||||||
!macro NSIS_HOOK_POSTINSTALL
|
|
||||||
; Check if Visual C++ Redistributable is already installed
|
|
||||||
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Version"
|
|
||||||
${If} $0 == ""
|
|
||||||
; Try alternative registry location
|
|
||||||
ReadRegStr $0 HKLM "SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Version"
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
${If} $0 == ""
|
|
||||||
; VC++ Redistributable not found, need to install
|
|
||||||
DetailPrint "Visual C++ Redistributable not found, installing from bundled file..."
|
|
||||||
|
|
||||||
; Install from bundled EXE if not installed
|
|
||||||
${If} ${FileExists} "$INSTDIR\resources\lib\vc_redist.x64.exe"
|
|
||||||
DetailPrint "Installing Visual C++ Redistributable..."
|
|
||||||
; Copy to TEMP folder and then execute installer
|
|
||||||
CopyFiles "$INSTDIR\resources\lib\vc_redist.x64.exe" "$TEMP\vc_redist.x64.exe"
|
|
||||||
ExecWait '"$TEMP\vc_redist.x64.exe" /quiet /norestart' $1
|
|
||||||
|
|
||||||
; Check whether installation process exited successfully (code 0) or not
|
|
||||||
${If} $1 == 0
|
|
||||||
DetailPrint "Visual C++ Redistributable installed successfully"
|
|
||||||
${ElseIf} $1 == 1638
|
|
||||||
DetailPrint "Visual C++ Redistributable already installed (newer version)"
|
|
||||||
${ElseIf} $1 == 3010
|
|
||||||
DetailPrint "Visual C++ Redistributable installed successfully (restart required)"
|
|
||||||
${Else}
|
|
||||||
DetailPrint "Visual C++ installation failed with exit code: $1"
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; Clean up setup files from TEMP and your installed app
|
|
||||||
Delete "$TEMP\vc_redist.x64.exe"
|
|
||||||
Delete "$INSTDIR\resources\lib\vc_redist.x64.exe"
|
|
||||||
${Else}
|
|
||||||
DetailPrint "Visual C++ Redistributable not found at expected location: $INSTDIR\resources\lib\vc_redist.x64.exe"
|
|
||||||
${EndIf}
|
|
||||||
${Else}
|
|
||||||
DetailPrint "Visual C++ Redistributable already installed (version: $0)"
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; ---- Copy LICENSE to install root ----
|
|
||||||
${If} ${FileExists} "$INSTDIR\resources\LICENSE"
|
|
||||||
CopyFiles /SILENT "$INSTDIR\resources\LICENSE" "$INSTDIR\LICENSE"
|
|
||||||
DetailPrint "Copied LICENSE to install root"
|
|
||||||
|
|
||||||
; Optional cleanup - remove from resources folder
|
|
||||||
Delete "$INSTDIR\resources\LICENSE"
|
|
||||||
${Else}
|
|
||||||
DetailPrint "LICENSE not found at expected location: $INSTDIR\resources\LICENSE"
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; ---- Copy vulkan-1.dll to install root ----
|
|
||||||
${If} ${FileExists} "$INSTDIR\resources\lib\vulkan-1.dll"
|
|
||||||
CopyFiles /SILENT "$INSTDIR\resources\lib\vulkan-1.dll" "$INSTDIR\vulkan-1.dll"
|
|
||||||
DetailPrint "Copied vulkan-1.dll to install root"
|
|
||||||
|
|
||||||
; Optional cleanup - remove from resources folder
|
|
||||||
Delete "$INSTDIR\resources\lib\vulkan-1.dll"
|
|
||||||
|
|
||||||
; Only remove the lib directory if it's empty after removing both files
|
|
||||||
RMDir "$INSTDIR\resources\lib"
|
|
||||||
${Else}
|
|
||||||
DetailPrint "vulkan-1.dll not found at expected location: $INSTDIR\resources\lib\vulkan-1.dll"
|
|
||||||
${EndIf}
|
|
||||||
!macroend
|
|
||||||
@ -82,7 +82,7 @@
|
|||||||
"remark-math": "6.0.0",
|
"remark-math": "6.0.0",
|
||||||
"sonner": "2.0.5",
|
"sonner": "2.0.5",
|
||||||
"tailwindcss": "4.1.4",
|
"tailwindcss": "4.1.4",
|
||||||
"token.js": "npm:token.js-fork@0.7.27",
|
"token.js": "npm:token.js-fork@0.7.29",
|
||||||
"tw-animate-css": "1.2.8",
|
"tw-animate-css": "1.2.8",
|
||||||
"ulidx": "2.4.1",
|
"ulidx": "2.4.1",
|
||||||
"unified": "11.0.5",
|
"unified": "11.0.5",
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export const predefinedProviders = [
|
|||||||
{
|
{
|
||||||
active: true,
|
active: true,
|
||||||
api_key: '',
|
api_key: '',
|
||||||
base_url: 'https://api.anthropic.com',
|
base_url: 'https://api.anthropic.com/v1',
|
||||||
provider: 'anthropic',
|
provider: 'anthropic',
|
||||||
explore_models_url:
|
explore_models_url:
|
||||||
'https://docs.anthropic.com/en/docs/about-claude/models',
|
'https://docs.anthropic.com/en/docs/about-claude/models',
|
||||||
@ -127,11 +127,21 @@ export const predefinedProviders = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
models: [],
|
models: [],
|
||||||
|
custom_header: [
|
||||||
|
{
|
||||||
|
header: 'anthropic-version',
|
||||||
|
value: '2023-06-01'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'anthropic-dangerous-direct-browser-access',
|
||||||
|
value: 'true'
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
active: true,
|
active: true,
|
||||||
api_key: '',
|
api_key: '',
|
||||||
base_url: 'https://api.cohere.ai/compatibility/v1',
|
base_url: 'https://api.cohere.ai/v1',
|
||||||
explore_models_url: 'https://docs.cohere.com/v2/docs/models',
|
explore_models_url: 'https://docs.cohere.com/v2/docs/models',
|
||||||
provider: 'cohere',
|
provider: 'cohere',
|
||||||
settings: [
|
settings: [
|
||||||
|
|||||||
@ -132,7 +132,10 @@ const ChatInput = ({
|
|||||||
const activeModels = await serviceHub
|
const activeModels = await serviceHub
|
||||||
.models()
|
.models()
|
||||||
.getActiveModels('llamacpp')
|
.getActiveModels('llamacpp')
|
||||||
setHasActiveModels(activeModels.length > 0)
|
const hasMatchingActiveModel = activeModels.some(
|
||||||
|
(model) => String(model) === selectedModel?.id
|
||||||
|
)
|
||||||
|
setHasActiveModels(activeModels.length > 0 && hasMatchingActiveModel)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to get active models:', error)
|
console.error('Failed to get active models:', error)
|
||||||
setHasActiveModels(false)
|
setHasActiveModels(false)
|
||||||
@ -145,7 +148,7 @@ const ChatInput = ({
|
|||||||
const intervalId = setInterval(checkActiveModels, 3000)
|
const intervalId = setInterval(checkActiveModels, 3000)
|
||||||
|
|
||||||
return () => clearInterval(intervalId)
|
return () => clearInterval(intervalId)
|
||||||
}, [serviceHub])
|
}, [serviceHub, selectedModel?.id])
|
||||||
|
|
||||||
// Check for mmproj existence or vision capability when model changes
|
// Check for mmproj existence or vision capability when model changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -320,9 +320,82 @@ export const useModelProvider = create<ModelProviderState>()(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version <= 3 && state?.providers) {
|
||||||
|
state.providers.forEach((provider) => {
|
||||||
|
// Migrate Anthropic provider base URL and add custom headers
|
||||||
|
if (provider.provider === 'anthropic') {
|
||||||
|
if (provider.base_url === 'https://api.anthropic.com') {
|
||||||
|
provider.base_url = 'https://api.anthropic.com/v1'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update base-url in settings
|
||||||
|
if (provider.settings) {
|
||||||
|
const baseUrlSetting = provider.settings.find(
|
||||||
|
(s) => s.key === 'base-url'
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
baseUrlSetting?.controller_props?.value ===
|
||||||
|
'https://api.anthropic.com'
|
||||||
|
) {
|
||||||
|
baseUrlSetting.controller_props.value =
|
||||||
|
'https://api.anthropic.com/v1'
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
baseUrlSetting?.controller_props?.placeholder ===
|
||||||
|
'https://api.anthropic.com'
|
||||||
|
) {
|
||||||
|
baseUrlSetting.controller_props.placeholder =
|
||||||
|
'https://api.anthropic.com/v1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!provider.custom_header) {
|
||||||
|
provider.custom_header = [
|
||||||
|
{
|
||||||
|
header: 'anthropic-version',
|
||||||
|
value: '2023-06-01',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: 'anthropic-dangerous-direct-browser-access',
|
||||||
|
value: 'true',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (provider.provider === 'cohere') {
|
||||||
|
if (provider.base_url === 'https://api.cohere.ai/compatibility/v1') {
|
||||||
|
provider.base_url = 'https://api.cohere.ai/v1'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update base-url in settings
|
||||||
|
if (provider.settings) {
|
||||||
|
const baseUrlSetting = provider.settings.find(
|
||||||
|
(s) => s.key === 'base-url'
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
baseUrlSetting?.controller_props?.value ===
|
||||||
|
'https://api.cohere.ai/compatibility/v1'
|
||||||
|
) {
|
||||||
|
baseUrlSetting.controller_props.value =
|
||||||
|
'https://api.cohere.ai/v1'
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
baseUrlSetting?.controller_props?.placeholder ===
|
||||||
|
'https://api.cohere.ai/compatibility/v1'
|
||||||
|
) {
|
||||||
|
baseUrlSetting.controller_props.placeholder =
|
||||||
|
'https://api.cohere.ai/v1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return state
|
return state
|
||||||
},
|
},
|
||||||
version: 3,
|
version: 4,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -39,7 +39,7 @@ function ModelProviders() {
|
|||||||
toast.error(t('providerAlreadyExists', { name }))
|
toast.error(t('providerAlreadyExists', { name }))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const newProvider = {
|
const newProvider: ProviderObject = {
|
||||||
provider: name,
|
provider: name,
|
||||||
active: true,
|
active: true,
|
||||||
models: [],
|
models: [],
|
||||||
|
|||||||
@ -578,6 +578,9 @@ export class DefaultModelsService implements ModelsService {
|
|||||||
}
|
}
|
||||||
}>
|
}>
|
||||||
}>
|
}>
|
||||||
|
chat_template_kwargs?: {
|
||||||
|
enable_thinking: boolean
|
||||||
|
}
|
||||||
}) => Promise<number>
|
}) => Promise<number>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,6 +657,9 @@ export class DefaultModelsService implements ModelsService {
|
|||||||
return await engine.getTokensCount({
|
return await engine.getTokensCount({
|
||||||
model: modelId,
|
model: modelId,
|
||||||
messages: transformedMessages,
|
messages: transformedMessages,
|
||||||
|
chat_template_kwargs: {
|
||||||
|
enable_thinking: false,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -151,6 +151,12 @@ export class TauriProvidersService extends DefaultProvidersService {
|
|||||||
headers['Authorization'] = `Bearer ${provider.api_key}`
|
headers['Authorization'] = `Bearer ${provider.api_key}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (provider.custom_header) {
|
||||||
|
provider.custom_header.forEach((header) => {
|
||||||
|
headers[header.header] = header.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Always use Tauri's fetch to avoid CORS issues
|
// Always use Tauri's fetch to avoid CORS issues
|
||||||
const response = await fetchTauri(`${provider.base_url}/models`, {
|
const response = await fetchTauri(`${provider.base_url}/models`, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|||||||
6
web-app/src/types/modelProviders.d.ts
vendored
6
web-app/src/types/modelProviders.d.ts
vendored
@ -48,6 +48,7 @@ type ProviderObject = {
|
|||||||
settings: ProviderSetting[]
|
settings: ProviderSetting[]
|
||||||
models: Model[]
|
models: Model[]
|
||||||
persist?: boolean
|
persist?: boolean
|
||||||
|
custom_header?: ProviderCustomHeader[] | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,3 +72,8 @@ type ProxyOptions = {
|
|||||||
verifyHostSSL: boolean
|
verifyHostSSL: boolean
|
||||||
noProxy: string
|
noProxy: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProviderCustomHeader = {
|
||||||
|
header: string
|
||||||
|
value: string
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user