Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move fts and stuff to frames fts #1472

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions screenpipe-server/src/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
ocr_engine: Option<CliOcrEngine>,
metadata_override: Option<PathBuf>,
copy_videos: bool,
use_embedding: bool,

Check warning on line 42 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `use_embedding`

Check warning on line 42 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `use_embedding`

Check warning on line 42 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-linux

unused variable: `use_embedding`

Check warning on line 42 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / Dependency & Performance Checks (ubuntu-latest)

unused variable: `use_embedding`
) -> Result<()> {
// Load metadata override if provided
let metadata_overrides = if let Some(path) = metadata_override {
Expand Down Expand Up @@ -77,8 +77,8 @@
}
}

let mut total_frames = 0;

Check warning on line 80 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

variable does not need to be mutable

Check warning on line 80 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

variable does not need to be mutable

Check warning on line 80 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-linux

variable does not need to be mutable

Check warning on line 80 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / Dependency & Performance Checks (ubuntu-latest)

variable does not need to be mutable
let mut total_text = 0;

Check warning on line 81 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

variable does not need to be mutable

Check warning on line 81 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

variable does not need to be mutable

Check warning on line 81 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-linux

variable does not need to be mutable

Check warning on line 81 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / Dependency & Performance Checks (ubuntu-latest)

variable does not need to be mutable

// Setup channel for OCR results

Expand Down Expand Up @@ -132,7 +132,7 @@
let frames = extract_frames_from_video(&video_path, None).await?;

// Create video chunk and frames first
let frame_ids = db

Check warning on line 135 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `frame_ids`

Check warning on line 135 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `frame_ids`

Check warning on line 135 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-linux

unused variable: `frame_ids`

Check warning on line 135 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / Dependency & Performance Checks (ubuntu-latest)

unused variable: `frame_ids`
.create_video_with_frames(
video_path.to_str().unwrap(),
frames.clone(),
Expand Down Expand Up @@ -162,7 +162,7 @@
continue;
}

previous_image = Some(frame.clone());

Check warning on line 165 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

value assigned to `previous_image` is never read

Check warning on line 165 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

value assigned to `previous_image` is never read

Check warning on line 165 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-linux

value assigned to `previous_image` is never read

Check warning on line 165 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / Dependency & Performance Checks (ubuntu-latest)

value assigned to `previous_image` is never read

// Use specified OCR engine or fall back to platform default
let engine = match ocr_engine {
Expand All @@ -178,10 +178,10 @@
}
};

let engine_arc = Arc::new(engine.clone());

Check warning on line 181 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `engine_arc`

Check warning on line 181 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `engine_arc`

Check warning on line 181 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-linux

unused variable: `engine_arc`

Check warning on line 181 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / Dependency & Performance Checks (ubuntu-latest)

unused variable: `engine_arc`

// Do OCR processing directly
let (text, _, confidence): (String, String, Option<f64>) = match engine.clone() {

Check warning on line 184 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `text`

Check warning on line 184 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `confidence`

Check warning on line 184 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `text`

Check warning on line 184 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused variable: `confidence`

Check warning on line 184 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-linux

unused variable: `text`

Check warning on line 184 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-linux

unused variable: `confidence`

Check warning on line 184 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / Dependency & Performance Checks (ubuntu-latest)

unused variable: `text`

Check warning on line 184 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / Dependency & Performance Checks (ubuntu-latest)

unused variable: `confidence`
#[cfg(target_os = "macos")]
OcrEngine::AppleNative => perform_ocr_apple(frame, &[]),
#[cfg(target_os = "windows")]
Expand All @@ -195,7 +195,7 @@
};

// Handle OCR results
total_frames += 1;

Check warning on line 198 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unreachable statement

Check warning on line 198 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unreachable statement

Check warning on line 198 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / test-linux

unreachable statement

Check warning on line 198 in screenpipe-server/src/add.rs

View workflow job for this annotation

GitHub Actions / Dependency & Performance Checks (ubuntu-latest)

unreachable statement
total_text += text.len();

// Only generate embeddings if flag is enabled
Expand Down Expand Up @@ -225,10 +225,7 @@
frame_ids[idx],
&text,
"{}", // empty json
"", // no app name
"", // no window name
engine_arc.clone(),
true, // focused
)
.await
{
Expand Down
19 changes: 9 additions & 10 deletions screenpipe-server/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,14 @@ async fn record_video(
if let Some(frame) = video_capture.ocr_frame_queue.pop() {
for window_result in &frame.window_ocr_results {
match db
.insert_frame(&device_name, None, window_result.browser_url.as_deref())
.insert_frame(
&device_name,
None,
window_result.browser_url.as_deref(),
Some(window_result.app_name.as_str()),
Some(window_result.window_name.as_str()),
window_result.focused,
)
.await
{
Ok(frame_id) => {
Expand Down Expand Up @@ -258,15 +265,7 @@ async fn record_video(
},
);
if let Err(e) = db
.insert_ocr_text(
frame_id,
text,
&text_json,
&window_result.app_name,
&window_result.window_name,
Arc::clone(&ocr_engine),
window_result.focused, // Add this line
)
.insert_ocr_text(frame_id, text, &text_json, Arc::clone(&ocr_engine))
.await
{
error!(
Expand Down
Loading
Loading