Skip to content

Commit 20c7eb3

Browse files
committed
feat: add comprehensive logging for browser and gptme-server output
- Add Tauri logging plugin with stdout and file targets - Set up console forwarding from browser to Tauri logs with loop prevention - Capture and forward gptme-server stdout/stderr to logging system - Enable Rust logs to appear in browser console via attachConsole() - Add log file persistence to application logs directory - Configure INFO level logging with proper formatting - Add pre-commit configuration with Rust, TypeScript, and general formatting hooks - Fix compilation error and apply automatic formatting fixes
1 parent 503a883 commit 20c7eb3

File tree

16 files changed

+477
-29
lines changed

16 files changed

+477
-29
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ jobs:
2929
sudo apt-get update
3030
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev \
3131
libjavascriptcoregtk-4.1-dev libsoup-3.0-dev
32-
32+
3333
- name: Rust setup
3434
uses: dtolnay/rust-toolchain@stable
3535

3636
- name: Rust cache
3737
uses: swatinem/rust-cache@v2
3838
with:
3939
workspaces: './src-tauri -> target'
40-
40+
4141
- name: Python setup
4242
uses: actions/setup-python@v4
4343
with:
@@ -50,7 +50,7 @@ jobs:
5050
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
5151
restore-keys: |
5252
${{ runner.os }}-pip-
53-
53+
5454
- name: Install Poetry
5555
run: |
5656
curl -sSL https://install.python-poetry.org | python3 -
@@ -73,4 +73,4 @@ jobs:
7373
env:
7474
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7575
with:
76-
args: ${{ matrix.args }}
76+
args: ${{ matrix.args }}

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: |
4343
rustup toolchain install nightly
4444
rustup component add --toolchain nightly clippy
45-
45+
4646
- name: Python setup
4747
uses: actions/setup-python@v4
4848
with:
@@ -55,7 +55,7 @@ jobs:
5555
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
5656
restore-keys: |
5757
${{ runner.os }}-pip-
58-
58+
5959
- name: Install Poetry
6060
run: |
6161
curl -sSL https://install.python-poetry.org | python3 -

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
libjavascriptcoregtk-4.1-dev=2.44.0-2 \
3737
gir1.2-javascriptcoregtk-4.1=2.44.0-2 \
3838
gir1.2-webkit2-4.1=2.44.0-2;
39-
39+
4040
- name: Rust setup
4141
uses: dtolnay/rust-toolchain@stable
4242

@@ -50,7 +50,7 @@ jobs:
5050
with:
5151
node-version: 'lts/*'
5252
cache: 'npm'
53-
53+
5454
- name: Python setup
5555
uses: actions/setup-python@v4
5656
with:
@@ -63,7 +63,7 @@ jobs:
6363
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
6464
restore-keys: |
6565
${{ runner.os }}-pip-
66-
66+
6767
- name: Install Poetry
6868
run: |
6969
curl -sSL https://install.python-poetry.org | python3 -

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ dist-ssr
2525

2626
src-tauri/icons/*
2727
bins
28-
gptme/build
28+
gptme/build

.pre-commit-config.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
repos:
2+
# General hooks
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.6.0
5+
hooks:
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
8+
- id: check-merge-conflict
9+
- id: check-added-large-files
10+
args: ['--maxkb=1000']
11+
- id: check-yaml
12+
- id: check-json
13+
- id: check-toml
14+
15+
# Rust formatting and linting
16+
- repo: https://github.com/doublify/pre-commit-rust
17+
rev: v1.0
18+
hooks:
19+
- id: fmt
20+
name: Rust format
21+
files: ^src-tauri/
22+
args: ['--manifest-path', 'src-tauri/Cargo.toml', '--all']
23+
pass_filenames: false
24+
- id: cargo-check
25+
name: Rust check
26+
files: ^src-tauri/
27+
args: ['--manifest-path', 'src-tauri/Cargo.toml']
28+
pass_filenames: false
29+
- id: clippy
30+
name: Rust clippy
31+
files: ^src-tauri/
32+
args: ['--manifest-path', 'src-tauri/Cargo.toml', '--', '-D', 'warnings']
33+
pass_filenames: false
34+
35+
# TypeScript/JavaScript formatting
36+
- repo: https://github.com/pre-commit/mirrors-prettier
37+
rev: v4.0.0-alpha.8
38+
hooks:
39+
- id: prettier
40+
files: \.(js|ts|tsx|json|css|md)$
41+
exclude: ^(gptme|gptme-webui)/
42+
43+
# Additional TypeScript checking (if you want to add it later)
44+
# - repo: https://github.com/pre-commit/mirrors-eslint
45+
# rev: v9.0.0
46+
# hooks:
47+
# - id: eslint
48+
# files: \.(js|ts|tsx)$
49+
# exclude: ^(gptme|gptme-webui)/
50+
# additional_dependencies:
51+
# - eslint@^8.0.0
52+
# - '@typescript-eslint/eslint-plugin@^6.0.0'
53+
# - '@typescript-eslint/parser@^6.0.0'

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
build: prebuild
2-
npm run tauri build
2+
@# i need the nO_STRIP=true for some reason, otherwise:
3+
@# > Error failed to bundle project: `failed to run linuxdeploy`"
4+
NO_STRIP=true npm run tauri build
35

46
dev: prebuild
57
npm run tauri dev
@@ -15,7 +17,7 @@ gptme-webui/dist: gptme-webui/.git
1517
npm i && cd gptme-webui && npm i && npm run build
1618

1719
gptme-server-build:
18-
# appends a platform-specific suffix, required by tauri
20+
# appends a platform-specific suffix, required by tauri
1921
mkdir -p bins
2022
cd gptme && make build-server-exe && mv dist/gptme-server ../bins/gptme-server-$$(rustc -Vv | grep host | cut -f2 -d' ')
2123

gptme.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
files = [
2+
"README.md",
3+
"Makefile",
4+
"package.json",
5+
"gptme/README.md",
6+
"gptme-webui/README.md",
7+
"src-tauri/Cargo.toml",
8+
"src-tauri/tauri.conf.json",
9+
]

package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)