Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Jul 30, 2024
1 parent c208cdd commit 961778f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ jobs:
ls .
bun install
# Run pre build
- name: Run pre_build.js on ${{ matrix.platform }}
shell: bash
run: bun ./scripts/pre_build.js ${{ matrix.pre-build-args }}
working-directory: ./examples/apps/screenpipe-app-tauri

- name: Build CLI
shell: bash
run: |
Expand All @@ -139,6 +133,12 @@ jobs:
fi
cargo build --release ${{ matrix.args }}
# Run pre build
- name: Run pre_build.js on ${{ matrix.platform }}
shell: bash
run: bun ./scripts/pre_build.js ${{ matrix.pre-build-args }}
working-directory: ./examples/apps/screenpipe-app-tauri

- name: Build
uses: tauri-apps/tauri-action@v0
env:
Expand Down
11 changes: 11 additions & 0 deletions examples/apps/screenpipe-app-tauri/scripts/pre_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ if (platform == 'linux') {
if (platform == 'windows') {
const wgetPath = await findWget();

console.log('Copying screenpipe binary...');
const screenpipeSrc = path.join(__dirname, '..', '..', '..', '..', 'target', 'release', 'screenpipe.exe');
const screenpipeDest = path.join(cwd, 'screenpipe.exe');
try {
await fs.copyFile(screenpipeSrc, screenpipeDest);
console.log('Screenpipe binary copied successfully.');
} catch (error) {
console.error('Failed to copy screenpipe binary:', error);
process.exit(1);
}

// Setup FFMPEG
if (!(await fs.exists(config.ffmpegRealname))) {
await $`${wgetPath} -nc --show-progress ${config.windows.ffmpegUrl} -O ${config.windows.ffmpegName}.7z`
Expand Down
2 changes: 2 additions & 0 deletions examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ tauri-plugin-store = "2.0.0-beta"
anyhow = "1.0.71"
which = "6.0.1"

# System information
sysinfo = "0.29.0"

# hakc
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs" }
Expand Down
10 changes: 9 additions & 1 deletion examples/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use serde_json::json;
use std::fs;
use std::sync::Arc;
use std::time::Duration;
use sysinfo::{System, SystemExt};
use tokio::sync::Mutex;
use tokio::time::interval;
use uuid::Uuid;

pub struct AnalyticsManager {
client: Client,
posthog_api_key: String,
Expand Down Expand Up @@ -38,14 +40,20 @@ impl AnalyticsManager {
}

let posthog_url = format!("{}/capture/", self.api_host);
let system = System::new_all();

let mut payload = json!({
"api_key": self.posthog_api_key,
"event": event,
"properties": {
"distinct_id": self.distinct_id,
"$lib": "rust-reqwest",
"timestamp": chrono::Utc::now().to_rfc3339(),
"os_name": system.name().unwrap_or_default(),
"os_version": system.os_version().unwrap_or_default(),
"kernel_version": system.kernel_version().unwrap_or_default(),
"host_name": system.host_name().unwrap_or_default(),
"cpu_count": system.cpus().len(),
"total_memory": system.total_memory(),
},
});

Expand Down
8 changes: 4 additions & 4 deletions examples/typescript/daily-log/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import fetch from "node-fetch";
import fs from "fs/promises";
import path from "path";

const OPENAI_API_URL = "https://api.openai.com/v1/chat/completions";
const OPENAI_MODEL = "gpt-4o";
// const OPENAI_API_URL = "https://api.openai.com/v1/chat/completions";
// const OPENAI_MODEL = "gpt-4o";
// Uncomment the following lines to use Ollama instead
// const OPENAI_API_URL = "http://localhost:11434/api/chat";
// const OPENAI_MODEL = "llama3.1";
const OPENAI_API_URL = "http://localhost:11434/api/chat";
const OPENAI_MODEL = "llama3.1";

const SCREENPIPE_API_URL = "http://localhost:3030/search";
const LOG_INTERVAL = 1 * 60 * 1000; // 5 minutes in milliseconds
Expand Down

0 comments on commit 961778f

Please sign in to comment.