diff --git a/.github/workflows/publish.yml.manual b/.github/workflows/publish.yml.manual deleted file mode 100644 index c3539b3..0000000 --- a/.github/workflows/publish.yml.manual +++ /dev/null @@ -1,105 +0,0 @@ -name: "publish" - -on: - push: - branches: - - release - # tags: - # - "v*" - -# `tauri-action` can also upload app bundles to an existing GitHub release. -# This workflow uses different actions to create and publish the release. -# `tauri-action` will only build and upload the app bundles to the specified release. - -jobs: - create-release: - permissions: - contents: write - runs-on: ubuntu-20.04 - outputs: - release_id: ${{ steps.create-release.outputs.result }} - - steps: - - uses: actions/checkout@v4 - - - name: setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: get version - run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV - - - name: create release - id: create-release - uses: actions/github-script@v6 - with: - script: | - const { data } = await github.rest.repos.createRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - tag_name: `v${process.env.PACKAGE_VERSION}`, - name: `Desktop App v${process.env.PACKAGE_VERSION}`, - body: 'Take a look at the assets to download and install this app.', - draft: true, - prerelease: false - }) - return data.id - - build-tauri: - needs: create-release - permissions: - contents: write - strategy: - fail-fast: false - matrix: - platform: [macos-latest, ubuntu-20.04, windows-latest] - - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v4 - - - name: setup node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable - - - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-20.04' - run: | - sudo apt-get update - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf - - - name: install frontend dependencies - run: yarn install # change this to npm or pnpm depending on which one you use - - - uses: tauri-apps/tauri-action@v0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - releaseId: ${{ needs.create-release.outputs.release_id }} - - publish-release: - permissions: - contents: write - runs-on: ubuntu-20.04 - needs: [create-release, build-tauri] - - steps: - - name: publish release - id: publish-release - uses: actions/github-script@v6 - env: - release_id: ${{ needs.create-release.outputs.release_id }} - with: - script: | - github.rest.repos.updateRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: process.env.release_id, - draft: false, - prerelease: false - }) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml new file mode 100644 index 0000000..8b1dab7 --- /dev/null +++ b/.github/workflows/rust-ci.yml @@ -0,0 +1,49 @@ +name: Rust CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + + - name: Install system dependencies + run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + + - name: Install cargo audit + run: cargo install cargo-audit + + - name: Build the project + run: cargo build --verbose + working-directory: ./src-tauri + + - name: Test the project + run: cargo test + working-directory: ./src-tauri + + - name: Run Clippy + run: cargo clippy -- -D warnings + working-directory: ./src-tauri + + - name: Run cargo audit + run: cargo audit + working-directory: ./src-tauri diff --git a/.vscode/settings.json b/.vscode/settings.json index 6cadbc4..a0c7840 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,8 @@ "./src-tauri/Cargo.toml", "./old/Cargo.toml" ], + "rust-analyzer.showUnlinkedFileNotification": false, + "rust-analyzer.check.command": "clippy", "[rust]": { "editor.formatOnPaste": true, "editor.formatOnSave": true @@ -13,6 +15,4 @@ // Ignore @tailwind warnings "css.lint.unknownAtRules": "ignore", "editor.fontSize": 14, - "rust-analyzer.showUnlinkedFileNotification": false, - "editor.fontFamily": "'JetBrains Mono medium', 'fira code', 'hack'", } diff --git a/notes.md b/notes.md index 75946a1..f92a111 100644 --- a/notes.md +++ b/notes.md @@ -3,3 +3,6 @@ run `yarn tauri dev` to start app in dev environment Note: `bun tauri dev` works on linux, but not on Macs right now.s + +fixes webkit bs in some linux instalations +export WEBKIT_DISABLE_COMPOSITING_MODE=1 diff --git a/old/src/main.rs b/old/src/main.rs index b334280..064555d 100644 --- a/old/src/main.rs +++ b/old/src/main.rs @@ -187,10 +187,10 @@ Feynman's legacy extends beyond the academic realm. Known for his playful approa prompt, stream: false, options: Options { - temperature: temperature.clone(), - repeat_penalty: repeat_penalty.clone(), - top_k: top_k.clone(), - top_p: top_p.clone(), + temperature: *temperature, + repeat_penalty: *repeat_penalty, + top_k: *top_k, + top_p: *top_p, }, }; // println!("Request object {:#?}", request_object); diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index d5bb384..2970461 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -46,10 +46,9 @@ pub async fn get_ollama_version(config: IDefaultConfigs) -> Result Error::StringError( - "Version Request failed with status: ".to_string() + &err.to_string(), - ), + .map_err(|err| { + let err_str = format!("Version Request failed with status: {}", err); + Error::StringError(err_str) })?; dbg!(&response); @@ -167,7 +166,7 @@ pub async fn get_inference( let req = GenerationRequest::new(params.clone().model, params.clone().prompt) .options(options) - .system(params.clone().system_prompt.into()) + .system(params.clone().system_prompt) .keep_alive(KeepAlive::UnloadOnCompletion); dbg!(&req); @@ -210,7 +209,7 @@ pub fn get_experiments(app_handle: tauri::AppHandle) -> Result = fs::read_dir(app_data_dir)? .filter_map(Result::ok) - .map(|entry| { + .filter_map(|entry| { let path = entry.path(); let metadata = fs::metadata(&path).ok()?; let created = metadata.created().ok()?; @@ -221,7 +220,6 @@ pub fn get_experiments(app_handle: tauri::AppHandle) -> Result String { pub fn split_host_port(url: &str) -> Result<(String, u16), ParseError> { let some_url = Url::parse(url)?; Ok(( - format!( - "{}://{}", - some_url.scheme(), - some_url.host_str().unwrap().to_string(), - ), + format!("{}://{}", some_url.scheme(), some_url.host_str().unwrap(),), some_url.port().unwrap(), )) } @@ -131,7 +127,7 @@ pub async fn log_experiment( // Create the logs directory if it doesn't exist if !Path::new(&app_data_dir).exists() { - fs::create_dir(&app_data_dir)?; + fs::create_dir(app_data_dir)?; } let mut log_data = if Path::new(&log_file_path).exists() {