Skip to content

Commit

Permalink
Merge branch 'local-ai' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
lucksus committed Nov 18, 2024
2 parents 23497b3 + 8d3d1b2 commit 0afc70b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ USER root

# Install system dependencies or any other tools you need
RUN apt-get update && sudo apt-get install -y \
libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf protobuf-compiler cmake
libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf protobuf-compiler cmake gobjc clang gnustep-devel libobjc4 libgnustep-base-dev libasound2-dev pkg-config fuse libfuse2 mesa-utils mesa-vulkan-drivers

# Install Go
ENV GO_VERSION 1.22.0
Expand All @@ -29,8 +29,8 @@ RUN echo 'export PATH="/usr/local/bin:$PATH"' >> $HOME/.bashrc
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> /home/circleci/.bashrc
RUN ~/.cargo/bin/rustup install 1.80
RUN ~/.cargo/bin/rustup default 1.80
RUN ~/.cargo/bin/rustup install 1.81
RUN ~/.cargo/bin/rustup default 1.81
RUN ~/.cargo/bin/rustup target add wasm32-unknown-unknown

# Install Deno
Expand Down
13 changes: 5 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ orbs:
jobs:
build-and-test:
docker:
- image: coasys/ad4m-ci-linux:latest@sha256:989a070068192050e61f2fab134f598739b0ec6756588fada602709081b28152
- image: coasys/ad4m-ci-linux:latest@sha256:2dd8206db5ee73ae58f48e2c2db595320ab88b94f5e0c0ddc99698191a03114f
resource_class: xlarge
steps:
- checkout
Expand Down Expand Up @@ -52,9 +52,6 @@ jobs:
- run:
name: cargo fmt --check
command: cargo fmt --check
- run:
name: install gobjc
command: sudo apt-get install gobjc clang gnustep-devel libobjc4 libgnustep-base-dev libasound2-dev pkg-config fuse libfuse2 mesa-utils mesa-vulkan-drivers
- run:
name: Install dependencies
command: pnpm install --no-frozen-lockfile
Expand All @@ -80,10 +77,10 @@ jobs:
paths:
- ./target/release/ad4m
- ./target/release/ad4m-executor
#- run:
# name: cargo clippy
# no_output_timeout: 30m
# command: cargo clippy --all --exclude ad4m-launcher
- run:
name: cargo clippy
no_output_timeout: 30m
command: cargo clippy --all --exclude ad4m-launcher
- run:
name: Remove pnpm patches
command: node removePnpm.js
Expand Down
8 changes: 4 additions & 4 deletions rust-executor/src/ai_service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl AIService {
Ok(tasks)
}

pub async fn spawn_embedding_model(&self, model_id: String) {
async fn spawn_embedding_model(&self, model_id: String) {
let (bert_tx, mut bert_rx) = mpsc::unbounded_channel::<EmbeddingRequest>();

thread::spawn({
Expand Down Expand Up @@ -296,7 +296,7 @@ impl AIService {
.insert(model_id, bert_tx);
}

pub async fn spawn_llm_model(&self, model_id: String) {
async fn spawn_llm_model(&self, model_id: String) {
let (llama_tx, mut llama_rx) = mpsc::unbounded_channel::<LLMTaskRequest>();

thread::spawn({
Expand Down Expand Up @@ -517,7 +517,7 @@ impl AIService {
pub async fn open_transcription_stream(&self, _model_id: String) -> Result<String> {
let stream_id = uuid::Uuid::new_v4().to_string();
let stream_id_clone = stream_id.clone();
let (samples_tx, sampels_rx) = futures_channel::mpsc::unbounded::<Vec<f32>>();
let (samples_tx, samples_rx) = futures_channel::mpsc::unbounded::<Vec<f32>>();
//TODO: use drop_rx to exit thread
let (drop_tx, drop_rx) = oneshot::channel();
let (done_tx, done_rx) = oneshot::channel();
Expand All @@ -534,7 +534,7 @@ impl AIService {
if let Ok(whisper) = maybe_model {
let audio_stream = AudioStream {
read_data: Vec::new(),
receiver: Box::pin(sampels_rx.map(futures_util::stream::iter).flatten()),
receiver: Box::pin(samples_rx.map(futures_util::stream::iter).flatten()),
};

let mut word_stream = audio_stream
Expand Down
9 changes: 4 additions & 5 deletions ui/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ pub fn run() {
open_logs_folder();
});

build_menu(&app.handle())?;
build_system_tray(&app.handle())?;
build_menu(app.handle())?;
build_system_tray(app.handle())?;

let config = rust_executor::Ad4mConfig {
admin_credential: Some(req_credential.to_string()),
Expand Down Expand Up @@ -295,15 +295,14 @@ pub fn run() {

Ok(())
})
.on_window_event(|window, event| match event {
tauri::WindowEvent::CloseRequested { api, .. } => {
.on_window_event(|window, event| {
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
if let Err(e) = window.hide() {
println!("Error trying to hide window: {:?}", e);
} else {
api.prevent_close();
}
}
_ => {}
})
.build(tauri::generate_context!());

Expand Down
10 changes: 6 additions & 4 deletions ui/src-tauri/src/system_tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ pub fn build_system_tray(app: &AppHandle) -> Result<()> {
_ => log::error!("Event is not defined."),
})
.menu_on_left_click(false)
.on_tray_icon_event(|tray, event| match event {
TrayIconEvent::Click {
.on_tray_icon_event(|tray, event| {
if let TrayIconEvent::Click {
button: MouseButton::Left,
button_state: MouseButtonState::Up,
..
} => toggle_main_window(tray.app_handle()),
_ => {}
} = event
{
toggle_main_window(tray.app_handle())
}
})
.build(app)?;

Expand Down
11 changes: 1 addition & 10 deletions ui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
"mainBinaryName": "ADAM Launcher",
"version": "0.10.0-rc9",
"identifier": "dev.ad4m.ad4min",
"plugins": {
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEM1OTBGNDkzMkI2MTczMEMKUldRTWMyRXJrL1NReGFTUVBTMjRhQWlEVTFuOHBkcEZwbmEwSG9DdWczeDdtRUdNK3hMMm1GUnoK",
"endpoints": [
"https://launcher-update-worker.perspect3vism.workers.dev/update/{{target}}/{{current_version}}"
]
}
},
"app": {
"security": {
"csp": null
Expand Down Expand Up @@ -78,7 +70,6 @@
"appimage": {
"bundleMediaFramework": true
}
},
"createUpdaterArtifacts": "v1Compatible"
}
}
}

0 comments on commit 0afc70b

Please sign in to comment.