Skip to content

Commit

Permalink
Merge pull request #31 from dezoito/ci
Browse files Browse the repository at this point in the history
Ci
  • Loading branch information
dezoito authored May 18, 2024
2 parents dad6173 + cd23ad5 commit b2c7ac8
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 124 deletions.
105 changes: 0 additions & 105 deletions .github/workflows/publish.yml.manual

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"./src-tauri/Cargo.toml",
"./old/Cargo.toml"
],
"rust-analyzer.showUnlinkedFileNotification": false,
"rust-analyzer.check.command": "clippy",
"[rust]": {
"editor.formatOnPaste": true,
"editor.formatOnSave": true
},
// Ignore @tailwind warnings
"css.lint.unknownAtRules": "ignore",
"editor.fontSize": 14,
"rust-analyzer.showUnlinkedFileNotification": false,
"editor.fontFamily": "'JetBrains Mono medium', 'fira code', 'hack'",
}
3 changes: 3 additions & 0 deletions notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions old/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 5 additions & 7 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ pub async fn get_ollama_version(config: IDefaultConfigs) -> Result<String, Error
.timeout(timeout)
.send()
.await
.map_err(|err| match err {
err => 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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -210,7 +209,7 @@ pub fn get_experiments(app_handle: tauri::AppHandle) -> Result<Vec<ExperimentFil
let app_data_dir = binding.to_str().unwrap();
let mut files: Vec<ExperimentFile> = 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()?;
Expand All @@ -221,7 +220,6 @@ pub fn get_experiments(app_handle: tauri::AppHandle) -> Result<Vec<ExperimentFil
contents,
})
})
.filter_map(std::convert::identity) // removes "Nones" from vector.
.collect();

files.sort_by_key(|file| file.created);
Expand Down
8 changes: 2 additions & 6 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ pub async fn wait_and_return(duration_seconds: u64) -> 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(),
))
}
Expand All @@ -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() {
Expand Down

0 comments on commit b2c7ac8

Please sign in to comment.