Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
529 commits
Select commit Hold shift + click to select a range
bf80cea
tweak: i18n key
Bin-Huang Jan 11, 2025
276c145
release: v0.10.4
Bin-Huang Jan 14, 2025
ff6037c
feat: add dependabot.yml (#1173)
nitrocode Jan 16, 2025
f759645
chore(deps-dev): bump electron-builder from 24.13.3 to 25.1.8 (#1751)
dependabot[bot] Jan 24, 2025
142bde4
chore(deps): bump @dnd-kit/modifiers from 6.0.1 to 9.0.0 (#1753)
dependabot[bot] Feb 10, 2025
3af992d
chore(deps-dev): bump tailwindcss from 3.3.2 to 4.0.0 (#1780)
dependabot[bot] Feb 10, 2025
db8c8a6
feat: Updating OpenAI versions (#1813)
josueggh Feb 10, 2025
947c494
chore: audit fix
Bin-Huang Feb 10, 2025
d920391
feat: add new model provider PPIO (#1967)
cnJasonZ Feb 11, 2025
f6a7939
chore(deps): bump web-vitals from 2.1.4 to 4.2.4 (#1752)
dependabot[bot] Feb 13, 2025
3bd442a
Chinese garbled characters
lance631 Mar 5, 2025
ccf8822
fix: modify version of tailwindcss (#2064)
2125zyrc Mar 20, 2025
1f551b3
Update PULL_REQUEST_TEMPLATE.md
themez Mar 20, 2025
4531aca
fix: add claude 3.7 sonnet and change default (#2068)
ahnafaf Mar 20, 2025
fe54896
feat: Spanish translation (#1812)
josueggh Mar 20, 2025
9fa1dc5
fix: correct engines field to prevent npm install error (#1817)
josueggh Mar 20, 2025
a211330
Fix/generate title problem (#1820)
eeren3411 Mar 20, 2025
5812875
modify en and cn readme. (#2108)
Tinyu-Zhao Mar 20, 2025
17f101e
Merge pull request #2112 from lance631/patch-1
wong2 Mar 20, 2025
97d32f9
chore: copy files from pro repo at release 1.11.8
themez Apr 10, 2025
f644c48
Revert "chore: update Sentry integration and dependencies (#209)"
themez Apr 11, 2025
9f02c6c
Feat: stop generating & default xAI models (#225)
ryanwangtian Apr 11, 2025
5ea3f69
feat: catch api error and upload to sentry (#227)
themez Apr 12, 2025
8c18926
Feat/update reminder (#226)
themez Apr 12, 2025
5cbbde8
fix: update appBundleId in notarize script for macOS notarization
themez Apr 12, 2025
785a648
fix: update button width
themez Apr 12, 2025
9ac14ae
fix: enhance error handling and display in MessageErrTips component (…
themez Apr 15, 2025
eed24fb
release 1.11.10
themez Apr 15, 2025
a73b427
fix: remove auto updater
themez Apr 19, 2025
dad1ad8
chore: update README
themez Apr 21, 2025
9e8540a
Update ModelSettingTab.tsx (#2273)
vigor-jzy Apr 21, 2025
32580ab
fix: auto-scroll to bottom when AI is generating long messages
Apr 22, 2025
e2cc380
Eliminate phantom dependencies (#2275)
galenjiang Apr 24, 2025
4fabe82
Refactor/storage (#237)
themez Apr 22, 2025
e9140b3
fix: auto translated changelog
themez Apr 23, 2025
46c6733
feat: remove x and wechat contact
themez Apr 23, 2025
679690d
chore: add logger util (#244)
wong2 Apr 23, 2025
1cdeee8
chore: remove utils/stream module (#246)
wong2 Apr 23, 2025
76f2fc7
feat: change new thread icon and tooltip (#245)
themez Apr 23, 2025
49480d9
release v1.12.0
themez Apr 24, 2025
458ab35
refactor: migrate openai model to ai sdk (#219)
wong2 Apr 8, 2025
e8dd884
chore: upgrade electron to v23 (#231)
wong2 Apr 15, 2025
16f8b90
chore: upgrade typescript to latest (#232)
wong2 Apr 15, 2025
e058285
Refactor/chatboxai ai sdk (#216)
themez Apr 8, 2025
c629e44
refactor: remove base model (#222)
wong2 Apr 9, 2025
b54af28
feat: use search tool api (#223)
themez Apr 10, 2025
8401d2a
feat: migrate web browsing to ai sdk tool (#228)
wong2 Apr 15, 2025
a480f4d
fix: read webBrowsing from atom when regenerating (#233)
wong2 Apr 15, 2025
f054189
feat: settings shortcut (#230)
themez Apr 16, 2025
9eba079
feat: implement paint for chatbox ai and custom openai (#236)
themez Apr 17, 2025
72adaca
fix: ensure correct API host format for Claude model (#234)
themez Apr 15, 2025
88c5c16
refactor: streamline migration and initialization process (#206)
themez Apr 17, 2025
b7f4625
fix: key down handler dup binding (#238)
themez Apr 18, 2025
9f77591
feat: remove ugly window frame (#235)
themez Apr 19, 2025
79fb6e4
Feature/consistent thread naming (#2322)
chaoliu719 May 14, 2025
e3e6345
fix: sidebar header cannot be dragged
themez Apr 26, 2025
0827859
feat: make logo as window draggable area
themez Apr 26, 2025
6c05cb4
fix: change new session button style from contained to outlined
themez Apr 27, 2025
1e002a9
feat: do not show dall-e for picture session
themez Apr 27, 2025
c7e0e8e
fix: katex fonts path
ryanwangtian Apr 27, 2025
fd72ae2
fix: chatbox api error tips (#247)
themez Apr 27, 2025
696b6d6
feat: log migration steps (#248)
themez Apr 28, 2025
3f6dae8
release v1.12.1
themez Apr 28, 2025
0e88110
fix: wait data save to storage when create new session (#249)
themez Apr 28, 2025
ac2e545
feat: optimize init process (#250)
themez Apr 28, 2025
1f13e54
feat: batch write migration data (#251)
themez Apr 29, 2025
9cb8770
release v1.12.2
themez Apr 29, 2025
3d5d06c
fix: should only use cmd as function key on mac
themez Apr 30, 2025
269e981
feat: send client version to api (#252)
themez Apr 30, 2025
c82b2d0
fix: compiling time optimization cause migration not running
themez May 7, 2025
233abf9
fix: recover lost data from migration 7 to 8 (#254)
themez May 7, 2025
bc868ca
feat: only recover data lost in migration 7-8, prevent recovering del…
themez May 8, 2025
8e7d5dd
release v1.12.3
themez May 8, 2025
70c9ccd
chore: remove pre push check for now
themez May 14, 2025
b4e69e8
fix: use 100% instead of 100vh
Jesse205 May 20, 2025
adcaa83
fix: fix the width error
Jesse205 May 21, 2025
d28df86
fix: add spaces
Jesse205 May 21, 2025
4ad6c65
Merge pull request #2327 from Jesse205/fix/use-100p-height
ryanwangtian May 22, 2025
e9270e7
Merge pull request #2328 from Jesse205/fix/min-width
ryanwangtian May 22, 2025
c96db21
Merge pull request #2278 from xiaoxiaowesley/main
ryanwangtian May 23, 2025
7b3a84c
feat: Add latest Anthropic Claude 4 models (#2336)
trrahul May 27, 2025
55423bd
Feat/refactor settings (#253)
ryanwangtian May 16, 2025
5e3cf70
feat: update gemini models (#258)
themez May 19, 2025
ff8c275
fix: message search results not migrated (#260)
themez May 19, 2025
ef0b546
Feat/setting enhance (#262)
ryanwangtian May 21, 2025
6e53517
feat: update gemini default models
themez May 21, 2025
d0b5c65
feat: adjust the style of session settings
ryanwangtian May 26, 2025
3ca76c6
Feat/favorite models (#264)
ryanwangtian May 28, 2025
3827a04
release v1.13.1
themez May 28, 2025
4275813
增加提取和翻译文本的脚本 (#265)
wong2 May 29, 2025
fe4e1aa
fix: header of the session page cannot be dragged (#266)
ryanwangtian May 29, 2025
b4d67eb
feat: add migration logs
themez May 29, 2025
d3f3c18
release v1.13.2
themez May 30, 2025
81106ab
fix: save session settings to sqlite storage to fix exceed quota error
themez Jun 2, 2025
2c662bd
fix: do not export apikey if not selected
themez Jun 3, 2025
4585a06
fix: upgrade @tanstack/router-plugin version
ryanwangtian Jun 3, 2025
b35ce63
fix: handle messages might be undefined
themez Jun 3, 2025
47e9be8
fix: storage save missed
themez Jun 3, 2025
ea630b2
fix: session message list
themez Jun 3, 2025
6236850
feat: provider options (#267)
themez Jun 5, 2025
94b0c5e
feat: show file export errors (#271)
themez Jun 5, 2025
264f55f
feat: support custom api path for custom provider, show error message…
themez Jun 8, 2025
9512960
release v1.13.3
themez Jun 8, 2025
65a7366
fix: use logical keys for shortcuts (fixes non-QWERTY layouts) (#2375)
Fr0benius Jun 9, 2025
61055e7
fix: wrong i18n placeholder cause input component not shown
themez Jun 8, 2025
7ef12f8
fix: storage performance issue
themez Jun 9, 2025
04763ff
release v1.13.4
themez Jun 9, 2025
15e9c29
feat: add provider volcengine (#273)
themez Jun 10, 2025
ad8ff42
fix: azure temperature not using session config
themez Jun 10, 2025
b400118
fix: type import
themez Jun 11, 2025
a3a4763
fix: custom model display name (#276)
themez Jun 12, 2025
422b230
fix: custom model name should not use empty string
themez Jun 12, 2025
76cd284
feat: update gemini model list
themez Jun 13, 2025
848f910
Feat/homepage (#274)
ryanwangtian Jun 13, 2025
6911438
mcp (#257)
wong2 Jun 5, 2025
54553ba
fix: add sideEffects: true to prod webpack config
wong2 Jun 5, 2025
113bfa2
fix: mcp stderr encoding on windows (#275)
wong2 Jun 11, 2025
618e94a
chore: replace space in mcp server name to underlines
wong2 Jun 12, 2025
f7bbb22
chore: tweak mcp spotlight style (#277)
wong2 Jun 13, 2025
1c32666
feat: track mcp events with plausible (#279)
wong2 Jun 16, 2025
7963c4c
Fix/homepage (#280)
ryanwangtian Jun 16, 2025
96a6d4c
release v1.14.0
themez Jun 16, 2025
b7875a0
fix: chatboxai models update overwrite all providers config (#281)
themez Jun 16, 2025
2c88ee7
release v1.14.1
themez Jun 16, 2025
e6ebabe
Merge pull request #2412 from jakub-nezasa/feature/fix_mcp_environmen…
jakub-nezasa Jun 26, 2025
ff6978e
fix(Sidebar): always hide when new chat created on small screen (#284)
SunskyXH Jun 17, 2025
b647064
fix: do not send the message when pressing enter on mobile (#282)
ryanwangtian Jun 18, 2025
5b60981
Fix/input box (#287)
ryanwangtian Jun 19, 2025
242af03
release 1.14.2
themez Jun 19, 2025
31365c0
fix(latex.ts): handle correctly latex when start with number (#286)
SunskyXH Jun 19, 2025
be4da55
fix: reasoning content for openrouter (#290)
themez Jun 21, 2025
7402659
feat: support supplimental instruction for translation
themez Jun 21, 2025
17da958
feat: support edit thread name (#289)
SunskyXH Jun 21, 2025
fb7a893
fix(markdown): limit katex max-width (#293)
SunskyXH Jun 23, 2025
b870eb8
default chat model & global temperature (#296)
ryanwangtian Jun 25, 2025
0662935
feat: add aihubmix app code
themez Jun 26, 2025
f124ab1
Feat/quota purchase (#303)
ryanwangtian Jun 27, 2025
3a199a0
feat: clear storage space, fix fontsize (#302)
themez Jun 27, 2025
8569452
fix: tooltip not shown on mobile
themez Jun 27, 2025
47717c7
feat: update siliconflow icon
themez Jun 28, 2025
9d9805b
feat: catch global error (#307)
themez Jun 28, 2025
cc70b1b
fix: possible undefined
themez Jun 28, 2025
648f5d9
release: v1.14.3
themez Jun 29, 2025
634d71f
chore: update changelog
themez Jun 29, 2025
fb424fe
chore: update links
themez Jul 22, 2025
f6fa5ad
fix: cannot read properties of undefined error when click edit sessio…
ryanwangtian Jun 30, 2025
931c5fb
release v1.14.4
themez Jul 3, 2025
436b461
feat: knowledge base (#261)
themez Jun 21, 2025
1e3575a
fix: kb db init error
themez Jun 23, 2025
754202a
chore: update sentry sample rate
themez Jun 23, 2025
62c07dd
feat: show intro info if no knowledge base created yet
themez Jun 23, 2025
d794b6c
fix: search tool dead loop
themez Jun 23, 2025
eff9412
feat: support search knowledgebase by prompt engineering (#298)
themez Jun 25, 2025
af8d292
feat: add toolcall transition, fix reasoning ui
themez Jun 25, 2025
4fb5a8d
feat: adjust reasoning style
themez Jun 25, 2025
14ff957
Feat/kb improve (#299)
themez Jun 26, 2025
f2e4b2a
feat: adjust toolcall action icon
themez Jun 26, 2025
65a7282
chore: lint file
themez Jun 27, 2025
6fd10bf
release v1.15.0-alpha.11 (#301)
themez Jun 27, 2025
4750c09
Feat/kb fix (#305)
themez Jun 27, 2025
cd5631e
fix: merging error
themez Jun 29, 2025
f27c0c1
chore: format code
themez Jun 29, 2025
51bc56d
Feat/kb alpha fix (#308)
themez Jun 29, 2025
f6f6601
fix: do not import non exist module (#311)
themez Jul 1, 2025
12b81d1
fix: catch libsql require error (#312)
themez Jul 1, 2025
f1c90ea
fix: CustomOpenAI model to use fetch function and add VolcEngine prov…
themez Jul 1, 2025
336c1c5
fix: translation key
themez Jul 1, 2025
9778698
feat: check chatboxai availability for kb (#314)
themez Jul 2, 2025
f01640d
feat: add info about aihubmix discount
themez Jul 2, 2025
dd2a84b
feat: custom provider fetch models and api path (#315)
themez Jul 3, 2025
c509003
fix: support file with uppercase ext
themez Jul 7, 2025
f5c077d
beautify the splash screen (#304)
ryanwangtian Jul 7, 2025
2aa514f
release v1.15.0
themez Jul 7, 2025
c64a8ce
fix: mermaid rendering (#317)
ryanwangtian Jul 7, 2025
bd62d82
feat: add gpt 4.1 mini and nano
themez Jul 9, 2025
24a4eec
feat: user can cancel mcp testing (#319)
wong2 Jul 9, 2025
2b19669
fix: provider model list should exclude user deleted models
themez Jul 10, 2025
6f94be9
feat: add max tokens in session settings (#318)
ryanwangtian Jul 10, 2025
588dc76
Feat/non stream output (#320)
themez Jul 10, 2025
6519e1b
feat: tweak inputbox style (#321)
themez Jul 10, 2025
736a31b
fix: mcp button size
themez Jul 11, 2025
bc8eea2
chore: upgrade mcp sdk (#323)
wong2 Jul 11, 2025
c155a18
feat: mcp json import supports remote servers (#324)
wong2 Jul 11, 2025
52fe094
fix: improve KaTeX math formula scrollbar styling (#325)
themez Jul 12, 2025
e777e27
fix(sessionActions): tweak delete forkMessage (#326)
SunskyXH Jul 12, 2025
4273135
feat: update grok models
themez Jul 12, 2025
3ef2e25
fix: session stream default option
themez Jul 12, 2025
813d2b5
feat: ocr image for non vision models (#327)
themez Jul 12, 2025
3ba2f7b
Fix/ollama cors (#329)
themez Jul 15, 2025
9f8ce02
feat: install mcp with deep link (#328)
wong2 Jul 15, 2025
c8683ee
fix: check window.electronAPI (#330)
wong2 Jul 15, 2025
7b73386
chore: improve copilot picker scroll ux (#322)
wong2 Jul 16, 2025
c66f791
fix: reset search params after reading deep link state (#334)
wong2 Jul 17, 2025
b1c1e45
fix: use js-base64 to decode base64 (#335)
wong2 Jul 17, 2025
5dbca5f
chore: tweak input box style
themez Jul 17, 2025
f0b634c
fix: model selector style
themez Jul 17, 2025
242e77a
fix: inputbox height
themez Jul 17, 2025
af77ce4
fix: openai compatible models
themez Jul 18, 2025
e520344
fix: topP range
themez Jul 18, 2025
4343f61
Feat/import provider (#332)
themez Jul 19, 2025
eaaf49c
chore: update changelog
themez Jul 19, 2025
ceaed54
chore: hide import from clipboard for mobile
themez Jul 19, 2025
7521e7d
fix: getSession may return undefined (#336)
ryanwangtian Jul 21, 2025
e256b86
release 1.15.1
themez Jul 22, 2025
b350acf
fix: update channel
themez Jul 23, 2025
7e2d707
feat: add timer to measure thinking block duration (新增思考块计时器) (#2507)
wc222 Jul 27, 2025
85a1619
Adding MistralAI (#2514)
julienheinen Jul 28, 2025
963cdea
feat: support edit multi parts (#340)
themez Jul 24, 2025
8398c41
fix: message copy should only copy content (#341)
themez Jul 24, 2025
1fbcc1a
Fix/UI tasks (#339)
ryanwangtian Jul 24, 2025
b93928d
fix: main request cause kb request fail (#342)
themez Jul 24, 2025
78f245f
fix: omit empty reasoning part (#343)
themez Jul 24, 2025
491bfd2
fix: omit unused settings fields to prevent unexpected name conflict …
ryanwangtian Jul 24, 2025
cd852c0
feat: reasoning content collapsed by default
themez Jul 24, 2025
b5dffcd
release v1.15.2
themez Jul 24, 2025
ea6e90f
Fix/version cache (#346)
themez Jul 26, 2025
7c7b4e6
chore: remove unused code
themez Jul 27, 2025
dfb1219
fix: inputbox focus
themez Jul 27, 2025
40644b8
fix: message edit width issue
themez Jul 27, 2025
f2a39ed
feat: update gemini models
themez Jul 29, 2025
bb463e7
feat: hide copilots in new session (#352)
themez Jul 29, 2025
e41230b
feat: add a minimum width to the settings page (#338)
ryanwangtian Jul 30, 2025
e1b5d8d
feat: transform mermaid static block for mobile compatibility (#357)
themez Jul 31, 2025
a6dcd79
feat: update copilots page layout (#359)
themez Jul 31, 2025
f38f454
fix: session settings reset (#358)
ryanwangtian Jul 31, 2025
d48b386
fix: reduce the display duration of the toast (#360)
ryanwangtian Jul 31, 2025
dfd8229
fix: reset dalleStyle
ryanwangtian Jul 31, 2025
dc21c40
feat: send session id header (#361)
themez Jul 31, 2025
abcea3d
chore: tweak copilots style
themez Aug 1, 2025
dff7968
fix: add stable time for chatbox ai models query to avoid unnecessary…
ryanwangtian Aug 1, 2025
2eb564d
fix: types
themez Aug 1, 2025
166134a
feat(InputBox): support draft (#337)
SunskyXH Aug 2, 2025
1fac91b
feat: chatboxai choose api style automatically (#364)
themez Aug 5, 2025
ac60521
feat: disable smoothStream
themez Aug 6, 2025
44a8f22
v1.15.3 (#366)
themez Aug 7, 2025
180d7c6
feat: remove showTokenCount setting (#370)
themez Aug 11, 2025
5b003b8
fix: clear draft immediately when sending message (#371)
themez Aug 11, 2025
cae0813
fix: mobile useProxy request (#369)
themez Aug 11, 2025
fdb7145
feat: display artifacts in full screen (#368)
ryanwangtian Aug 11, 2025
8e97728
feat: show unnormal stop reason (#372)
themez Aug 12, 2025
cbace4c
fix: clear draft imediatly after submitted (#373)
themez Aug 12, 2025
a0acbb5
fix: prevent duplicate conversation name generation requests (#374)
themez Aug 12, 2025
9de2912
feat: upgrade ai sdk for gpt5 support (#375)
themez Aug 12, 2025
c7979a8
feat: add gpt-5-chat-latest and chatglm-4.5 models
themez Aug 12, 2025
532d2c7
feat: enable swipe to open on iOS (#376)
ryanwangtian Aug 12, 2025
3c04725
fix: remove redundant title
themez Aug 12, 2025
58f06f3
fix: properly display API error response body for 400 errors
themez Aug 12, 2025
b6c5264
v1.15.4
themez Aug 11, 2025
9e33c9f
[Chore]: Enforce supported Node/npm versions and update prerequisites…
deepak-terse Aug 20, 2025
1fb8b37
feat: add "My First Chat" as default chat
CamelliaRui Oct 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .erb/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"cssVariables.lookupFiles": [
"**/*.css",
"**/*.scss",
"**/*.sass",
"**/*.less",
"node_modules/@mantine/core/styles.css"
]
}
7 changes: 7 additions & 0 deletions .erb/configs/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rules": {
"no-console": "off",
"global-require": "off",
"import/no-dynamic-require": "off"
}
}
87 changes: 87 additions & 0 deletions .erb/configs/webpack.config.base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* Base webpack config used across other specific configs
*/

import webpack from 'webpack'
import TsconfigPathsPlugins from 'tsconfig-paths-webpack-plugin'
import webpackPaths from './webpack.paths'
import { dependencies as externals } from '../../release/app/package.json'

const configuration: webpack.Configuration = {
externals: [...Object.keys(externals || {})],

stats: 'errors-only',

module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: [/node_modules/, /\.d\.ts$/],
use: {
loader: 'ts-loader',
options: {
// Remove this line to enable type checking in webpack builds
transpileOnly: true,
compilerOptions: {
module: 'esnext',
},
},
},
},
// Special rule for mermaid to transpile static blocks
{
test: /\.m?js$/,
include: /node_modules\/mermaid/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', {
targets: {
chrome: '58',
firefox: '60',
safari: '11',
edge: '16',
ios: '11',
android: '67'
}
}]
],
plugins: [
'@babel/plugin-transform-class-static-block'
]
}
}
},
],
},

output: {
path: webpackPaths.srcPath,
// https://github.com/webpack/webpack/issues/1114
library: {
type: 'commonjs2',
},
},

/**
* Determine the array of extensions that should be used to resolve modules.
*/
resolve: {
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
modules: [webpackPaths.srcPath, 'node_modules'],
// There is no need to add aliases here, the paths in tsconfig get mirrored
plugins: [new TsconfigPathsPlugins()],
},

plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'production',
CHATBOX_BUILD_TARGET: 'unknown',
CHATBOX_BUILD_PLATFORM: 'unknown',
USE_LOCAL_API: '',
}),
],
}

export default configuration
3 changes: 3 additions & 0 deletions .erb/configs/webpack.config.eslint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* eslint import/no-unresolved: off, import/no-self-import: off */

module.exports = require('./webpack.config.renderer.dev').default
89 changes: 89 additions & 0 deletions .erb/configs/webpack.config.main.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/**
* Webpack config for production electron main process
*/

import path from 'path'
import TerserPlugin from 'terser-webpack-plugin'
import webpack from 'webpack'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import { merge } from 'webpack-merge'
import JavaScriptObfuscator from 'webpack-obfuscator'
import checkNodeEnv from '../scripts/check-node-env'
import baseConfig from './webpack.config.base'
import webpackPaths from './webpack.paths'

checkNodeEnv('production')

const configuration: webpack.Configuration = {
devtool: false,

mode: 'production',

target: 'electron-main',

entry: {
main: path.join(webpackPaths.srcMainPath, 'main.ts'),
preload: path.join(webpackPaths.srcMainPath, 'preload.ts'),
},

output: {
path: webpackPaths.distMainPath,
filename: '[name].js',
library: {
type: 'umd',
},
},

optimization: {
minimizer: [
new TerserPlugin({
parallel: true,
}),
],
},

plugins: [
new BundleAnalyzerPlugin({
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
analyzerPort: 8888,
}),

/**
* Create global constants which can be configured at compile time.
*
* Useful for allowing different behaviour between development builds and
* release builds
*
* NODE_ENV should be production so that modules do not perform certain
* development checks
*/
new webpack.EnvironmentPlugin({
NODE_ENV: 'production',
DEBUG_PROD: false,
START_MINIMIZED: false,
}),

new webpack.DefinePlugin({
'process.type': '"browser"',
}),

new JavaScriptObfuscator({
target: 'node',
optionsPreset: 'default',
// 默认的变量名混淆,可能被误报为恶意代码
identifierNamesGenerator: 'mangled-shuffled',
}),
],

/**
* Disables webpack processing of __dirname and __filename.
* If you run the bundle in node.js it falls back to these values of node.js.
* https://github.com/webpack/webpack/issues/2010
*/
node: {
__dirname: false,
__filename: false,
},
}

export default merge(baseConfig, configuration)
71 changes: 71 additions & 0 deletions .erb/configs/webpack.config.preload.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import path from 'path'
import webpack from 'webpack'
import { merge } from 'webpack-merge'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import baseConfig from './webpack.config.base'
import webpackPaths from './webpack.paths'
import checkNodeEnv from '../scripts/check-node-env'

// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's
// at the dev webpack config is not accidentally run in a production environment
if (process.env.NODE_ENV === 'production') {
checkNodeEnv('development')
}

const configuration: webpack.Configuration = {
devtool: 'inline-source-map',

mode: 'development',

target: 'electron-preload',

entry: path.join(webpackPaths.srcMainPath, 'preload.ts'),

output: {
path: webpackPaths.dllPath,
filename: 'preload.js',
library: {
type: 'umd',
},
},

plugins: [
new BundleAnalyzerPlugin({
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
}),

/**
* Create global constants which can be configured at compile time.
*
* Useful for allowing different behaviour between development builds and
* release builds
*
* NODE_ENV should be production so that modules do not perform certain
* development checks
*
* By default, use 'development' as NODE_ENV. This can be overriden with
* 'staging', for example, by changing the ENV variables in the npm scripts
*/
new webpack.EnvironmentPlugin({
NODE_ENV: 'development',
}),

new webpack.LoaderOptionsPlugin({
debug: true,
}),
],

/**
* Disables webpack processing of __dirname and __filename.
* If you run the bundle in node.js it falls back to these values of node.js.
* https://github.com/webpack/webpack/issues/2010
*/
node: {
__dirname: false,
__filename: false,
},

watch: true,
}

export default merge(baseConfig, configuration)
85 changes: 85 additions & 0 deletions .erb/configs/webpack.config.renderer.dev.dll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/**
* Builds the DLL for development electron renderer process
*/

import webpack from 'webpack'
import path from 'path'
import { merge } from 'webpack-merge'
import baseConfig from './webpack.config.base'
import webpackPaths from './webpack.paths'
import { dependencies } from '../../package.json'
import checkNodeEnv from '../scripts/check-node-env'

checkNodeEnv('development')

const EXCLUDE_MODULES = new Set([
'@modelcontextprotocol/sdk', // avoid `Package path . is not exported from package` error
'@mastra/core',
'@mastra/rag',
'@libsql/client',
'capacitor-stream-http', // local file dependency
])

const dist = webpackPaths.dllPath

const configuration: webpack.Configuration = {
context: webpackPaths.rootPath,

devtool: 'eval',

mode: 'development',

target: 'electron-renderer',

externals: ['fsevents', 'crypto-browserify'],

/**
* Use `module` from `webpack.config.renderer.dev.js`
*/
module: require('./webpack.config.renderer.dev').default.module,

entry: {
renderer: Object.keys(dependencies || {}).filter((dependency) => !EXCLUDE_MODULES.has(dependency)),
},

output: {
path: dist,
filename: '[name].dev.dll.js',
library: {
name: 'renderer',
type: 'var',
},
},

plugins: [
new webpack.DllPlugin({
path: path.join(dist, '[name].json'),
name: '[name]',
}),

/**
* Create global constants which can be configured at compile time.
*
* Useful for allowing different behaviour between development builds and
* release builds
*
* NODE_ENV should be production so that modules do not perform certain
* development checks
*/
new webpack.EnvironmentPlugin({
NODE_ENV: 'development',
}),

new webpack.LoaderOptionsPlugin({
debug: true,
options: {
context: webpackPaths.srcPath,
output: {
path: webpackPaths.dllPath,
},
},
}),
],
}

export default merge(baseConfig, configuration)
Loading