Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
Merge remote-tracking branch 'origin/dev' into mobile/dev
Vanaliteb2c5063e0b72
diff --cc package.jsonindex 8d96075e4,2ec212088..7e56913d8--- a/package.json+++ b/package.json@@@ -24,18 -24,12 +24,18 @@@"serve:web-app": "yarn workspace @janhq/web-app serve:web","build:serve:web-app": "yarn build:web-app && yarn serve:web-app","dev:tauri": "yarn build:icon && yarn copy:assets:tauri && cross-env IS_CLEAN=true tauri dev",+ "dev:ios": "yarn copy:assets:mobile && RUSTC_WRAPPER= yarn tauri ios dev",+ "dev:android": "yarn copy:assets:mobile && yarn tauri android dev",+ "build:android": "yarn build && yarn copy:assets:mobile && yarn tauri android build --no-default-features --features mobile",+ "build:ios": "yarn build && yarn copy:assets:mobile && yarn tauri ios build --no-default-features --features mobile",+ "build:ios:device": "yarn build && yarn copy:assets:mobile && yarn tauri ios build --no-default-features --features mobile --export-method debugging","copy:assets:tauri": "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:bin": "node ./scripts/download-bin.mjs",- "build:tauri:win32": "yarn download:bin && yarn tauri build",- "build:tauri:linux": "yarn download:bin && NO_STRIP=1 ./src-tauri/build-utils/shim-linuxdeploy.sh yarn tauri build --verbose && ./src-tauri/build-utils/buildAppImage.sh",- "build:tauri:darwin": "yarn tauri build --target universal-apple-darwin",+ "build:tauri:win32": "yarn download:bin && yarn download:lib && yarn tauri build",+ "build:tauri:linux": "yarn download:bin && yarn download:lib && 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": "yarn build:icon && yarn copy:assets:tauri && run-script-os","build:tauri:plugin:api": "cd src-tauri/plugins && yarn install && yarn workspaces foreach -Apt run build","build:icon": "tauri icon ./src-tauri/icons/icon.png",diff --cc src-tauri/Cargo.tomlindex aa7425f81,51e84f880..07272b7bf--- a/src-tauri/Cargo.toml+++ b/src-tauri/Cargo.toml@@@ -62,9 -59,10 +62,10 @@@ serde = { version = "1.0", features = [serde_json = "1.0"serde_yaml = "0.9.34"tar = "0.4"+ zip = "0.6"tauri-plugin-deep-link = { version = "2.3.4" }tauri-plugin-dialog = "2.2.1"-tauri-plugin-hardware = { path = "./plugins/tauri-plugin-hardware" }+tauri-plugin-hardware = { path = "./plugins/tauri-plugin-hardware", optional = true }tauri-plugin-http = { version = "2", features = ["unsafe-headers"] }tauri-plugin-llamacpp = { path = "./plugins/tauri-plugin-llamacpp" }tauri-plugin-log = "2.0.0-rc"diff --cc web-app/src/containers/LeftPanel.tsxindex a6a31218a,67e35fab2..0a86fcf16--- a/web-app/src/containers/LeftPanel.tsx+++ b/web-app/src/containers/LeftPanel.tsx@@@ -141,8 -141,8 +141,9 @@@ const LeftPanel = () =>return () => {window.removeEventListener('resize', handleResize)}- }, [open, setLeftPanel])+ }, [setLeftPanel, open])++const currentPath = useRouterState({select: (state) => state.location.pathname,})diff --cc web-app/src/containers/__tests__/ChatInput.test.tsxindex 8c2f86bc2,50b0b6172..5038672d9--- a/web-app/src/containers/__tests__/ChatInput.test.tsx+++ b/web-app/src/containers/__tests__/ChatInput.test.tsx@@@ -228,10 -175,6 +228,7 @@@ describe('ChatInput', () =>return render(<RouterProvider router={router} />)}- const renderChatInput = () => {- return render(<ChatInput />)- }+beforeEach(() => {vi.clearAllMocks()@@@ -245,13 -188,12 +242,12 @@@mockAppState.tools = []})- it('renders chat input textarea', () => {- const { container } = renderChatInput()-- // Debug: log the rendered HTML- // console.log(container.innerHTML)+ it('renders chat input textarea', async () => {+ await act(async () => {+ renderWithRouter()+ })- const textarea = screen.getByRole('textbox')+ const textarea = screen.getByTestId('chat-input')expect(textarea).toBeInTheDocument()expect(textarea).toHaveAttribute('placeholder', 'common:placeholder.chatInput')})@@@ -284,10 -230,14 +284,14 @@@it('calls setPrompt when typing in textarea', async () => {const user = userEvent.setup()- renderWithRouter()+ await act(async () => {+ renderWithRouter()+ })-- const textarea = screen.getByRole('textbox')- await user.type(textarea, 'Hello')++ const textarea = screen.getByTestId('chat-input')+ await act(async () => {+ await user.type(textarea, 'Hello')+ })// setPrompt is called for each character typedexpect(mockPromptState.setPrompt).toHaveBeenCalledTimes(5)@@@ -316,10 -270,14 +324,14 @@@// Set prompt contentmockPromptState.prompt = 'Hello world'- renderWithRouter()+ await act(async () => {+ renderWithRouter()+ })-- const textarea = screen.getByRole('textbox')- await user.type(textarea, '{Enter}')++ const textarea = screen.getByTestId('chat-input')+ await act(async () => {+ await user.type(textarea, '{Enter}')+ })// Just verify the textarea exists and Enter was processedexpect(textarea).toBeInTheDocument()@@@ -331,10 -289,14 +343,14 @@@// Set prompt contentmockPromptState.prompt = 'Hello world'- renderWithRouter()+ await act(async () => {+ renderWithRouter()+ })-- const textarea = screen.getByRole('textbox')- await user.type(textarea, '{Shift>}{Enter}{/Shift}')++ const textarea = screen.getByTestId('chat-input')+ await act(async () => {+ await user.type(textarea, '{Shift>}{Enter}{/Shift}')+ })// Just verify the textarea existsexpect(textarea).toBeInTheDocument()@@@ -405,12 -375,14 +429,14 @@@// Mock connected serversmockGetConnectedServers.mockResolvedValue(['server1'])- renderChatInput()+ await act(async () => {+ renderWithRouter()+ })await waitFor(() => {- // Tools dropdown should be rendered (as SVG icon with tabler-icon-tool class)- const toolsIcon = document.querySelector('.tabler-icon-tool')- expect(toolsIcon).toBeInTheDocument()+ // Tools dropdown should be rendered+ const toolsDropdown = screen.getByTestId('tools-dropdown')+ expect(toolsDropdown).toBeInTheDocument()})})diff --cc web-app/src/lib/platform/const.tsindex ee9632aab,ab5a14e79..5e7561fa9--- a/web-app/src/lib/platform/const.ts+++ b/web-app/src/lib/platform/const.ts@@@ -69,9 -60,8 +69,12 @@@ export const PlatformFeatures: Record<P[PlatformFeature.GOOGLE_ANALYTICS]: !isPlatformTauri(),// Alternate shortcut bindings - enabled for web only (to avoid browser conflicts)- [PlatformFeature.ALTERNATE_SHORTCUT_BINDINGS]: !isPlatformTauri(),+ [PlatformFeature.ALTERNATE_SHORTCUT_BINDINGS]:+ !isPlatformTauri() && !isPlatformIOS() && !isPlatformAndroid(),+ // Shortcut+ [PlatformFeature.SHORTCUT]: !isPlatformIOS() && !isPlatformAndroid(),+++ // First message persisted thread - enabled for web only+ [PlatformFeature.FIRST_MESSAGE_PERSISTED_THREAD]: !isPlatformTauri(),-}+}