Skip to content

Commit

Permalink
fix #584
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Nov 9, 2024
1 parent f7ca07b commit 7d85f5d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
6 changes: 6 additions & 0 deletions screenpipe-app-tauri/components/search-chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,12 @@ export function SearchChat({
return;
}

// Track AI usage metrics
posthog.capture("ai_chat_usage", {
agent: selectedAgent.name,
total_chars: floatingInput.length + selectedContentLength
});

const userMessage = {
id: generateId(),
role: "user" as const,
Expand Down
2 changes: 1 addition & 1 deletion screenpipe-core/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::ValueEnum;
use serde::Serialize;
use std::fmt;

#[derive(ValueEnum, Clone, Debug, Serialize)]
#[derive(ValueEnum, Clone, Debug, Serialize, Hash, Eq, PartialEq)]
#[serde(rename_all = "kebab-case")]
#[repr(usize)]
pub enum Language {
Expand Down
5 changes: 3 additions & 2 deletions screenpipe-server/src/bin/screenpipe-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ async fn main() -> anyhow::Result<()> {
cli.monitor_id.clone()
};

let languages = cli.language.clone();
let languages = cli.unique_languages().unwrap();
let languages_clone = languages.clone();

let ocr_engine_clone = cli.ocr_engine.clone();
let vad_engine = cli.vad_engine.clone();
Expand Down Expand Up @@ -535,7 +536,7 @@ async fn main() -> anyhow::Result<()> {
println!("│ {:<19} │ {:<34} │", "", "all languages");
} else {
let total_languages = cli.language.len();
for (_, language) in cli.language.iter().enumerate().take(MAX_ITEMS_TO_DISPLAY) {
for (_, language) in languages_clone.iter().enumerate().take(MAX_ITEMS_TO_DISPLAY) {
let language_str = format!("id: {}", language);
let formatted_language = format_cell(&language_str, VALUE_WIDTH);
println!("│ {:<19} │ {:<34} │", "", formatted_language);
Expand Down
14 changes: 14 additions & 0 deletions screenpipe-server/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,20 @@ pub struct Cli {

}



impl Cli {
pub fn unique_languages(&self) -> Result<Vec<Language>, String> {
let mut unique_langs = std::collections::HashSet::new();
for lang in &self.language {
if !unique_langs.insert(lang.clone()) {
// continue don't care
}
}
Ok(unique_langs.into_iter().collect())
}
}

#[derive(Subcommand)]
pub enum Command {
/// Pipe management commands
Expand Down

0 comments on commit 7d85f5d

Please sign in to comment.