From 54a81e5ba009eaafb2caca194d447bb19899faca Mon Sep 17 00:00:00 2001 From: hauke Date: Fri, 6 Nov 2026 14:35:33 +0100 Subject: [PATCH] chore #14740: remove claude config and customer selection Summaries are not coming to the desktop app, and the customer is chosen in the web UI after the upload: - drop the Anthropic key (Service::Anthropic, Settings field) and delete a leftover keyring entry best-effort at startup - drop the Summary model, the store's summary accessors and the "Zusammenfassung" tab; the transcript is the detail's only content - drop the mocked customer accounts, list_accounts/set_account and the "Kunde" dropdown; calls.account_id and summaries stay in the schema Co-Authored-By: Claude Opus 5.5 (1M context) --- README.md | 4 +- crates/core/src/accounts.rs | 82 ----------------------- crates/core/src/call_view.rs | 7 +- crates/core/src/http.rs | 9 ++- crates/core/src/lib.rs | 7 +- crates/core/src/model.rs | 38 +---------- crates/core/src/pipeline.rs | 1 - crates/core/src/retention.rs | 3 +- crates/core/src/secrets.rs | 33 +++++++-- crates/core/src/store.rs | 122 +++++----------------------------- src-tauri/src/commands.rs | 16 ----- src-tauri/src/lib.rs | 4 +- src-tauri/src/state.rs | 36 ---------- ui/src/lib/api.ts | 12 +--- ui/src/routes/Main.svelte | 110 ++---------------------------- ui/src/routes/Settings.svelte | 5 +- 16 files changed, 72 insertions(+), 417 deletions(-) delete mode 100644 crates/core/src/accounts.rs diff --git a/README.md b/README.md index 4a7cece..beff625 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Gesprächsrekorder A Tauri 2 desktop app that records calls (Teams, MicroSIP, browser-based -softphones, …), then transcribes and summarizes them. +softphones, …) and transcribes them. ## Workspace layout - `crates/core` (`recorder-core`) — core domain logic: call detection, - recording orchestration, transcription and summarization. Independent of + recording orchestration and transcription. Independent of the Tauri app shell and the audio backend so it can be unit-tested without a GUI, a sound device or network access. - `crates/audio` (`recorder-audio`) — audio capture and WAV/FLAC encoding. diff --git a/crates/core/src/accounts.rs b/crates/core/src/accounts.rs deleted file mode 100644 index 6e7025d..0000000 --- a/crates/core/src/accounts.rs +++ /dev/null @@ -1,82 +0,0 @@ -//! Customer accounts a call can be assigned to (the "Kunde" dropdown). -//! -//! A static mock for now: the names are clearly fictional placeholders -//! until the account system is connected. - -use serde::Serialize; - -/// A customer account. `id` is what a call stores as its `account_id`. -#[derive(Serialize, Clone, Copy, Debug, PartialEq, Eq)] -pub struct Account { - pub id: &'static str, - pub name: &'static str, -} - -const MOCK_ACCOUNTS: [Account; 5] = [ - Account { - id: "mock-1", - name: "Weingut Beispiel GmbH", - }, - Account { - id: "mock-2", - name: "Weinhandel Muster KG", - }, - Account { - id: "mock-3", - name: "Vinothek Probe", - }, - Account { - id: "mock-4", - name: "Kellerei Test eG", - }, - Account { - id: "mock-5", - name: "Restaurant Platzhalter", - }, -]; - -/// All accounts, in display order. -pub fn list() -> Vec { - MOCK_ACCOUNTS.to_vec() -} - -/// Whether `id` names one of the accounts. -pub fn exists(id: &str) -> bool { - MOCK_ACCOUNTS.iter().any(|account| account.id == id) -} - -#[cfg(test)] -mod tests { - use std::collections::HashSet; - - use super::*; - - #[test] - fn mock_accounts_are_stable_and_unique() { - let accounts = list(); - let names: Vec<_> = accounts.iter().map(|a| a.name).collect(); - assert_eq!( - names, - [ - "Weingut Beispiel GmbH", - "Weinhandel Muster KG", - "Vinothek Probe", - "Kellerei Test eG", - "Restaurant Platzhalter", - ] - ); - let ids: HashSet<_> = accounts.iter().map(|a| a.id).collect(); - assert_eq!(ids.len(), 5); - // Stored with the calls, so they must never change. - assert_eq!(accounts[0].id, "mock-1"); - assert_eq!(accounts[4].id, "mock-5"); - assert_eq!(list(), accounts); - } - - #[test] - fn only_listed_accounts_exist() { - assert!(exists("mock-3")); - assert!(!exists("mock-6")); - assert!(!exists("")); - } -} diff --git a/crates/core/src/call_view.rs b/crates/core/src/call_view.rs index 53c5db7..e11731e 100644 --- a/crates/core/src/call_view.rs +++ b/crates/core/src/call_view.rs @@ -45,13 +45,12 @@ pub fn duration_secs(call: &Call) -> i64 { } /// The selected call's header data: its list row plus the error of a -/// failed run and the assigned account. +/// failed run. #[derive(Serialize, Clone, Debug, PartialEq)] pub struct CallHeader { #[serde(flatten)] pub item: CallListItem, pub error: Option, - pub account_id: Option, } /// A transcript line with the speaker's display label. @@ -115,7 +114,6 @@ impl CallDetail { call: CallHeader { item: CallListItem::of(call), error: call.error.clone(), - account_id: call.account_id.clone(), }, segments, merges: merge_views(merges, &speaker_names), @@ -176,7 +174,6 @@ mod tests { out_path: PathBuf::from("7-out.wav"), transcribed_at: None, audio_deleted: false, - account_id: None, title: None, } } @@ -330,7 +327,6 @@ mod tests { let mut c = call(Some(at(10, 15, 0))); c.status = CallStatus::Failed; c.error = Some("Netzwerkfehler".into()); - c.account_id = Some("mock-2".into()); c.title = Some("Reklamation".into()); let merges = keys(&[("remote:2", "remote:1")]); @@ -349,7 +345,6 @@ mod tests { "interrupted": false, "title": "Reklamation", "error": "Netzwerkfehler", - "account_id": "mock-2", }, "segments": [], "speaker_names": {}, diff --git a/crates/core/src/http.rs b/crates/core/src/http.rs index e53ae7d..d941a6d 100644 --- a/crates/core/src/http.rs +++ b/crates/core/src/http.rs @@ -1,7 +1,6 @@ -//! The HTTP transport seam: every outgoing request the DeepScript and Claude -//! clients (Tasks 12/13) make goes through [`HttpTransport`], so unit tests -//! can swap in [`crate::testing::FakeTransport`] and run with the network -//! unplugged. [`ReqwestTransport`] is the real implementation, exercised only +//! The HTTP transport seam: every outgoing request the API clients make goes +//! through [`HttpTransport`], so unit tests can swap in +//! [`crate::testing::FakeTransport`] and run with the network unplugged. [`ReqwestTransport`] is the real implementation, exercised only //! by the live integration suite (`crates/core/tests/live_api.rs`). use std::path::PathBuf; @@ -101,7 +100,7 @@ pub trait HttpTransport: Send + Sync { /// Live `HttpTransport` backed by `reqwest` (rustls). Shares one /// `reqwest::Client` (connection pooling) with a 10 minute request timeout -/// and a 30 second connect timeout, matching the Claude/DeepScript clients' +/// and a 30 second connect timeout, matching the DeepScript client's /// worst-case wait. pub struct ReqwestTransport { client: reqwest::Client, diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 82f789f..d8cce5c 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -1,10 +1,9 @@ //! Core domain logic for the Gesprächsrekorder call recorder. //! -//! This crate will grow to hold call detection, recording orchestration, -//! transcription and summarization logic, kept independent of the Tauri -//! application shell so it can be unit-tested without a GUI or network. +//! Call detection, recording orchestration and transcription, kept +//! independent of the Tauri application shell so it can be unit-tested +//! without a GUI or network. -pub mod accounts; pub mod audio; pub mod call_view; pub mod capture; diff --git a/crates/core/src/model.rs b/crates/core/src/model.rs index 1b0f4bf..fd19902 100644 --- a/crates/core/src/model.rs +++ b/crates/core/src/model.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; -use chrono::{DateTime, Local, NaiveDate}; +use chrono::{DateTime, Local}; use serde::{Deserialize, Serialize}; /// Primary key of a `calls` row (SQLite `rowid`). @@ -37,7 +37,6 @@ pub struct Call { pub out_path: PathBuf, pub transcribed_at: Option>, pub audio_deleted: bool, - pub account_id: Option, /// The name the user gave the call, if any. pub title: Option, } @@ -97,38 +96,3 @@ pub struct Segment { pub end: f64, pub text: String, } - -/// Who owns a to-do coming out of the call summary. -#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq)] -#[serde(rename_all = "lowercase")] -pub enum Owner { - Ich, - Kunde, - Sonstige, -} - -/// A single action item extracted from the call summary. -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -pub struct Todo { - pub text: String, - pub owner: Owner, - pub faellig: Option, - #[serde(default)] - pub erledigt: bool, -} - -/// The next agreed point of contact, if any. -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default)] -pub struct NaechsterKontakt { - pub datum: Option, - pub notiz: Option, -} - -/// Structured summary produced by Claude for a finished call. -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] -pub struct Summary { - pub kernpunkte: Vec, - pub vereinbarungen: Vec, - pub todos: Vec, - pub naechster_kontakt: NaechsterKontakt, -} diff --git a/crates/core/src/pipeline.rs b/crates/core/src/pipeline.rs index 282d02e..c4828fc 100644 --- a/crates/core/src/pipeline.rs +++ b/crates/core/src/pipeline.rs @@ -108,7 +108,6 @@ async fn run( // Jobs whose delete failed in an earlier run. delete_remote_jobs(store, tr, id).await; } - // SUMMARY SEAM (Task 14b): summarize here. store.set_status(id, CallStatus::Done, None)?; log::info!("call {id}: done"); Ok(()) diff --git a/crates/core/src/retention.rs b/crates/core/src/retention.rs index 9ff1965..1011b6b 100644 --- a/crates/core/src/retention.rs +++ b/crates/core/src/retention.rs @@ -10,7 +10,7 @@ use crate::model::{Call, CallId, CallStatus}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum RetentionAction { /// Delete the call's audio file(s) on disk; the row stays (it has a - /// summary/transcript worth keeping). + /// transcript worth keeping). DeleteAudio(CallId), /// Delete the whole call row (and everything derived from it). DeleteCall(CallId), @@ -88,7 +88,6 @@ mod tests { out_path: PathBuf::from("/tmp/out.wav"), transcribed_at: None, audio_deleted: false, - account_id: None, title: None, } } diff --git a/crates/core/src/secrets.rs b/crates/core/src/secrets.rs index 4bcade4..a6ec99b 100644 --- a/crates/core/src/secrets.rs +++ b/crates/core/src/secrets.rs @@ -15,7 +15,6 @@ pub const KEYRING_SERVICE: &str = "eu.euvino.callrecorder"; #[serde(rename_all = "lowercase")] pub enum Service { DeepScript, - Anthropic, } impl Service { @@ -23,7 +22,6 @@ impl Service { pub fn user(self) -> &'static str { match self { Service::DeepScript => "deepscript", - Service::Anthropic => "anthropic", } } } @@ -45,6 +43,10 @@ pub trait SecretStore: Send + Sync { fn delete(&self, s: Service) -> Result<()>; } +/// Keyring users of keys that earlier versions stored and this one no +/// longer uses: the Anthropic key of the dropped Claude summary. +const UNUSED_USERS: [&str; 1] = ["anthropic"]; + /// The OS keyring. pub struct KeyringSecrets; @@ -53,6 +55,21 @@ impl KeyringSecrets { keyring::Entry::new(KEYRING_SERVICE, s.user()) .map_err(|e| SecretError::Keyring(e.to_string())) } + + /// Best-effort deletes the keys earlier versions stored and this one no + /// longer uses, so no stale secret lingers in the keyring. Missing + /// entries and failures are only logged (never the key). + pub fn remove_unused_keys() { + for user in UNUSED_USERS { + let result = + keyring::Entry::new(KEYRING_SERVICE, user).and_then(|e| e.delete_credential()); + match result { + Ok(()) => log::info!("removed the unused keyring entry {user:?}"), + Err(keyring::Error::NoEntry) => {} + Err(e) => log::info!("could not remove the unused keyring entry {user:?}: {e}"), + } + } + } } impl SecretStore for KeyringSecrets { @@ -100,6 +117,8 @@ impl SecretStore for MemorySecrets { mod tests { use super::*; + const SERVICES: &[Service] = &[Service::DeepScript]; + #[test] fn memory_secrets_roundtrip() { let secrets = MemorySecrets::default(); @@ -107,16 +126,22 @@ mod tests { secrets.set(Service::DeepScript, "ds-key").unwrap(); assert_eq!(secrets.get(Service::DeepScript).as_deref(), Some("ds-key")); - assert_eq!(secrets.get(Service::Anthropic), None); secrets.delete(Service::DeepScript).unwrap(); assert_eq!(secrets.get(Service::DeepScript), None); secrets.delete(Service::DeepScript).unwrap(); } + #[test] + fn unused_keys_never_include_a_key_in_use() { + for &s in SERVICES { + assert!(!UNUSED_USERS.contains(&s.user()), "{s:?}"); + } + } + #[test] fn service_serializes_as_keyring_user() { - for s in [Service::DeepScript, Service::Anthropic] { + for &s in SERVICES { let json = serde_json::to_string(&s).unwrap(); assert_eq!(json, format!("\"{}\"", s.user())); assert_eq!(serde_json::from_str::(&json).unwrap(), s); diff --git a/crates/core/src/store.rs b/crates/core/src/store.rs index 04eb3cf..2df2d7b 100644 --- a/crates/core/src/store.rs +++ b/crates/core/src/store.rs @@ -1,5 +1,5 @@ -//! SQLite-backed persistence for calls, their transcripts, summaries, -//! speaker renames and outstanding remote transcription/summary jobs. +//! SQLite-backed persistence for calls, their transcripts, speaker renames +//! and merges, and outstanding remote transcription jobs. use std::collections::BTreeMap; use std::path::{Path, PathBuf}; @@ -10,7 +10,7 @@ use rusqlite::{params, Connection, Row, TransactionBehavior}; use thiserror::Error; use crate::merge::{self, MergeError}; -use crate::model::{Call, CallId, CallStatus, Segment, Speaker, Summary}; +use crate::model::{Call, CallId, CallStatus, Segment, Speaker}; /// Longest call title, in characters. const MAX_TITLE_CHARS: usize = 120; @@ -22,8 +22,8 @@ pub enum StoreError { Sqlite(#[from] rusqlite::Error), /// A value read back from SQLite could not be interpreted, e.g. an - /// unknown `status` string, invalid RFC 3339 timestamp, unparsable - /// speaker key or malformed summary JSON. + /// unknown `status` string, invalid RFC 3339 timestamp or unparsable + /// speaker key. #[error("corrupt stored value: {0}")] Corrupt(String), @@ -51,7 +51,9 @@ pub struct RecoveryReport { pub failed: Vec, } -/// Version 1: the first release. +/// Version 1: the first release. `calls.account_id` (the customer mock) and +/// `summaries` are no longer used; they stay so no migration has to drop +/// them. const SCHEMA_V1_SQL: &str = " CREATE TABLE IF NOT EXISTS calls ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -152,8 +154,8 @@ impl Store { let conn = self.conn.lock().unwrap(); conn.execute( "INSERT INTO calls \ - (app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, account_id) \ - VALUES (?1, ?2, NULL, ?3, 0, NULL, ?4, ?5, NULL, 0, NULL)", + (app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted) \ + VALUES (?1, ?2, NULL, ?3, 0, NULL, ?4, ?5, NULL, 0)", params![ app, dt_to_str(started_at), @@ -271,33 +273,6 @@ impl Store { Ok(segments) } - pub fn save_summary(&self, id: CallId, summary: &Summary, edited: bool) -> Result<()> { - let conn = self.conn.lock().unwrap(); - let json = serde_json::to_string(summary) - .map_err(|e| StoreError::Corrupt(format!("failed to serialize summary: {e}")))?; - conn.execute( - "INSERT INTO summaries (call_id, json, edited) VALUES (?1, ?2, ?3) \ - ON CONFLICT(call_id) DO UPDATE SET json = excluded.json, edited = excluded.edited", - params![id, json, edited], - )?; - Ok(()) - } - - pub fn summary(&self, id: CallId) -> Result> { - let conn = self.conn.lock().unwrap(); - let mut stmt = conn.prepare("SELECT json FROM summaries WHERE call_id = ?1")?; - let mut rows = stmt.query(params![id])?; - match rows.next()? { - Some(row) => { - let json: String = row.get(0)?; - let summary = serde_json::from_str(&json) - .map_err(|e| StoreError::Corrupt(format!("invalid summary json: {e}")))?; - Ok(Some(summary)) - } - None => Ok(None), - } - } - pub fn set_speaker_name(&self, id: CallId, speaker_key: &str, name: &str) -> Result<()> { let conn = self.conn.lock().unwrap(); conn.execute( @@ -398,8 +373,9 @@ impl Store { Ok(()) } - /// Deletes a call and every row derived from it (segments, summary, - /// speaker names and merges, remote jobs). + /// Deletes a call and every row derived from it (segments, speaker + /// names and merges, remote jobs; also the `summaries` table of schema + /// v1, which nothing writes). pub fn delete_call(&self, id: CallId) -> Result<()> { let mut conn = self.conn.lock().unwrap(); let tx = conn.transaction()?; @@ -413,15 +389,6 @@ impl Store { Ok(()) } - pub fn set_account(&self, id: CallId, account_id: Option<&str>) -> Result<()> { - let conn = self.conn.lock().unwrap(); - conn.execute( - "UPDATE calls SET account_id = ?1 WHERE id = ?2", - params![account_id, id], - )?; - Ok(()) - } - pub fn record_remote_job(&self, id: CallId, track: &str, remote_id: &str) -> Result<()> { let conn = self.conn.lock().unwrap(); conn.execute( @@ -470,7 +437,7 @@ impl Store { /// `AwaitingDecision`, with `interrupted` set and `ended_at` set to now /// if it was not already set (a later pass corrects it from the WAV /// length). - /// - `Processing` calls were mid-transcription/summarization: they move + /// - `Processing` calls were mid-transcription: they move /// to `Failed` with a fixed error message. /// /// Both updates run in a single transaction. @@ -547,9 +514,9 @@ fn ids_with_status(conn: &rusqlite::Connection, status: CallStatus) -> Result Result { let id: CallId = row.get(0)?; @@ -563,8 +530,7 @@ fn row_to_call(row: &Row) -> Result { let out_path: String = row.get(8)?; let transcribed_at: Option = row.get(9)?; let audio_deleted: bool = row.get(10)?; - let account_id: Option = row.get(11)?; - let title: Option = row.get(12)?; + let title: Option = row.get(11)?; Ok(Call { id, @@ -578,7 +544,6 @@ fn row_to_call(row: &Row) -> Result { out_path: PathBuf::from(out_path), transcribed_at: opt_dt_from_str(transcribed_at)?, audio_deleted, - account_id, title, }) } @@ -637,9 +602,7 @@ mod tests { use chrono::Local; - use crate::model::{ - CallId, CallStatus, NaechsterKontakt, Owner, Segment, Speaker, Summary, Todo, - }; + use crate::model::{CallId, CallStatus, Segment, Speaker}; use crate::store::Store; /// The schema of user_version 1, exactly as the first release created @@ -754,7 +717,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs ( let call = store.get_call(1).unwrap().expect("call kept"); assert_eq!(call.app, "Microsoft Teams"); assert_eq!(call.status, CallStatus::Done); - assert_eq!(call.account_id.as_deref(), Some("mock-2")); assert_eq!(call.mic_path, PathBuf::from("/rec/1-mic.wav")); assert_eq!(call.title, None); let texts: Vec<_> = store @@ -939,38 +901,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs ( assert_eq!(store.segments(id).unwrap(), second); } - #[test] - fn summary_roundtrip_with_null_dates() { - let store = Store::open_in_memory().unwrap(); - let id = store - .create_call( - "teams.exe", - Local::now(), - Path::new("/tmp/mic.wav"), - Path::new("/tmp/out.wav"), - ) - .unwrap(); - - assert_eq!(store.summary(id).unwrap(), None); - - let summary = Summary { - kernpunkte: vec!["Punkt 1".to_string()], - vereinbarungen: vec!["Angebot folgt".to_string()], - todos: vec![Todo { - text: "Angebot schicken".to_string(), - owner: Owner::Ich, - faellig: None, - erledigt: false, - }], - naechster_kontakt: NaechsterKontakt { - datum: None, - notiz: None, - }, - }; - store.save_summary(id, &summary, false).unwrap(); - assert_eq!(store.summary(id).unwrap(), Some(summary)); - } - #[test] fn speaker_names_upsert() { let store = Store::open_in_memory().unwrap(); @@ -1167,21 +1097,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs ( }], ) .unwrap(); - store - .save_summary( - id, - &Summary { - kernpunkte: vec![], - vereinbarungen: vec![], - todos: vec![], - naechster_kontakt: NaechsterKontakt { - datum: None, - notiz: None, - }, - }, - false, - ) - .unwrap(); store.set_speaker_name(id, "me", "Ich").unwrap(); store.set_speaker_merge(id, "remote:2", "remote:1").unwrap(); store @@ -1192,7 +1107,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs ( assert_eq!(store.get_call(id).unwrap(), None); assert_eq!(store.segments(id).unwrap(), Vec::new()); - assert_eq!(store.summary(id).unwrap(), None); assert_eq!(store.speaker_names(id).unwrap(), BTreeMap::new()); assert_eq!(store.remote_jobs(id).unwrap(), Vec::new()); assert_eq!(store.speaker_merges(id).unwrap(), BTreeMap::new()); diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs index cc4c4d3..8adf399 100644 --- a/src-tauri/src/commands.rs +++ b/src-tauri/src/commands.rs @@ -8,7 +8,6 @@ use std::thread; use std::time::Duration; -use recorder_core::accounts::{self, Account}; use recorder_core::call_view::{CallDetail, CallListItem}; use recorder_core::capture::Devices; use recorder_core::model::CallId; @@ -186,21 +185,6 @@ pub fn rename_call( Ok(()) } -#[tauri::command] -pub fn list_accounts() -> Vec { - accounts::list() -} - -/// Assigns a call to a customer account, or to none. -#[tauri::command] -pub fn set_account( - state: State<'_, AppState>, - id: CallId, - account_id: Option, -) -> CmdResult<()> { - state.set_account(id, account_id.as_deref()) -} - /// Deletes a finished call's audio and row. Closes the prompt if no call /// waits for it any more; otherwise the prompt reloads and shows the next. /// While its DeepScript jobs are still on record, nothing is deleted and a diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index c136661..ebd15d7 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -83,6 +83,8 @@ pub fn run() { &config_dir.join("last-version"), &app.package_info().version.to_string(), ); + // Off the main thread: the keyring can be slow to answer. + std::thread::spawn(KeyringSecrets::remove_unused_keys); // Before anything can start a run. processing::clear_upload_dir(app.handle()); app.manage(state); @@ -137,8 +139,6 @@ pub fn run() { commands::merge_speakers, commands::unmerge_speaker, commands::rename_call, - commands::list_accounts, - commands::set_account, updater::get_update, updater::install_update, ]) diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs index 912436a..f0c0a8f 100644 --- a/src-tauri/src/state.rs +++ b/src-tauri/src/state.rs @@ -17,7 +17,6 @@ use std::time::{Duration, Instant}; use chrono::{DateTime, Local}; use recorder_audio::RenderSession; -use recorder_core::accounts; use recorder_core::call_view::{self, CallDetail, CallListItem}; use recorder_core::capture::{CaptureSource, OutputTarget}; use recorder_core::detect::{CallDetector, DetectorEvent, MicSession}; @@ -496,17 +495,6 @@ impl AppState { self.store.set_title(id, title).map_err(|e| e.to_string()) } - /// Assigns call `id` to one of the [`accounts`], or to none. - pub fn set_account(&self, id: CallId, account_id: Option<&str>) -> Result<(), String> { - if account_id.is_some_and(|account| !accounts::exists(account)) { - return Err("Unbekannter Kunde".to_string()); - } - self.find_call(id)?; - self.store - .set_account(id, account_id) - .map_err(|e| format!("Kunde konnte nicht gespeichert werden: {e}")) - } - fn find_call(&self, id: CallId) -> Result { self.store .get_call(id) @@ -1244,30 +1232,6 @@ mod tests { ); } - #[test] - fn the_account_is_set_and_cleared() { - let f = fixture(); - let (id, _, _) = finished_call(&f, "a"); - let account = |f: &Fixture| f.state.store.get_call(id).unwrap().unwrap().account_id; - - f.state.set_account(id, Some("mock-2")).unwrap(); - assert_eq!(account(&f).as_deref(), Some("mock-2")); - f.state.set_account(id, None).unwrap(); - assert_eq!(account(&f), None); - } - - #[test] - fn only_known_accounts_and_calls_are_assigned() { - let f = fixture(); - let (id, _, _) = finished_call(&f, "a"); - assert!(f.state.set_account(id, Some("mock-99")).is_err()); - assert!(f.state.set_account(id + 1, Some("mock-1")).is_err()); - assert_eq!( - f.state.store.get_call(id).unwrap().unwrap().account_id, - None - ); - } - #[test] fn invalid_detection_delays_are_not_saved() { let f = fixture(); diff --git a/ui/src/lib/api.ts b/ui/src/lib/api.ts index b1deb2a..15bc4db 100644 --- a/ui/src/lib/api.ts +++ b/ui/src/lib/api.ts @@ -17,7 +17,7 @@ export interface Settings { end_after_secs: number } -export type Service = 'deepscript' | 'anthropic' +export type Service = 'deepscript' export interface DeviceInfo { id: string @@ -87,7 +87,7 @@ export interface SpeakerMerge { } export interface CallDetail { - call: CallListItem & { error: string | null; account_id: string | null } + call: CallListItem & { error: string | null } /** The transcript with speaker merges applied. */ segments: SegmentView[] /** Renamed speakers by key. */ @@ -95,11 +95,6 @@ export interface CallDetail { merges: SpeakerMerge[] } -export interface Account { - id: string - name: string -} - /** A newer version the release feed offers. */ export interface UpdateInfo { version: string @@ -149,9 +144,6 @@ export const unmergeSpeaker = (id: CallId, fromKey: string) => /** `null` or an empty title restores the default heading. */ export const renameCall = (id: CallId, title: string | null) => invoke('rename_call', { id, title }) -export const listAccounts = () => invoke('list_accounts') -export const setAccount = (id: CallId, accountId: string | null) => - invoke('set_account', { id, accountId }) export const getUpdate = () => invoke('get_update') /** Resolves only on failure: on success the app restarts. */ export const installUpdate = () => invoke('install_update') diff --git a/ui/src/routes/Main.svelte b/ui/src/routes/Main.svelte index 93890f8..7024883 100644 --- a/ui/src/routes/Main.svelte +++ b/ui/src/routes/Main.svelte @@ -5,7 +5,6 @@ errorText, getCall, getRecordingState, - listAccounts, listCalls, mergeSpeakers, onCallEnded, @@ -15,12 +14,10 @@ renameCall, renameSpeaker, retryCall, - setAccount, showRecorder, startManualRecording, transcribeCall, unmergeSpeaker, - type Account, type CallDetail, type CallId, type CallListItem, @@ -35,7 +32,6 @@ let calls = $state([]) let loaded = $state(false) let listError = $state('') - let accounts = $state([]) let recordingState = $state({ state: 'idle' }) let recordBusy = $state(false) @@ -46,7 +42,6 @@ let detailError = $state('') let actionError = $state('') let busy = $state(false) - let tab = $state<'summary' | 'transcript'>('transcript') let editingTitle = $state(false) let titleDraft = $state('') @@ -132,9 +127,6 @@ getRecordingState() .then((state) => (recordingState = state)) .catch((err) => (recordError = errorText(err))) - listAccounts() - .then((list) => (accounts = list)) - .catch((err) => (listError = errorText(err))) return () => unlisten.forEach((u) => u.then((off) => off())) }) @@ -186,20 +178,6 @@ refreshList() }) - function changeAccount(event: Event) { - const select = event.currentTarget as HTMLSelectElement - const previous = detail?.call.account_id ?? '' - run(async (id) => { - try { - await setAccount(id, select.value || null) - } catch (err) { - select.value = previous - throw err - } - await refreshDetail() - }) - } - async function rename(speakerKey: string, name: string) { if (!detail) return await renameSpeaker(detail.call.id, speakerKey, name) @@ -256,13 +234,6 @@ return parts.join(' · ') } - /** The account list plus the stored account if it is no longer listed. */ - let accountOptions = $derived.by(() => { - const stored = detail?.call.account_id - if (!stored || accounts.some((a) => a.id === stored)) return accounts - return [...accounts, { id: stored, name: `${stored} (unbekannt)` }] - }) - // A failed start (e.g. missing key) also marks the call failed; its // error is then shown once, in the failure box. let shownActionError = $derived(actionError !== detail?.call.error ? actionError : '') @@ -332,15 +303,6 @@

{titleError}

{/if}
- {#if call.status === 'awaiting_decision'} @@ -377,33 +339,13 @@
{call.error ?? 'Unbekannter Fehler'}
{:else} -
- - -
-
- {#if tab === 'summary'} -

Die Zusammenfassung kommt in einer späteren Version.

- {:else} - - {/if} -
+ {/if} {:else if detailError} @@ -552,17 +494,6 @@ margin-top: 12px; } - .customer { - display: inline-flex; - align-items: center; - gap: 8px; - font-weight: 600; - } - - .customer select { - max-width: 260px; - } - .actions { display: inline-flex; gap: 8px; @@ -588,31 +519,4 @@ background: var(--rec-soft); color: var(--rec); } - - .tabs { - display: flex; - gap: 4px; - border-bottom: 1px solid var(--border); - } - - .tabs button { - padding: 8px 14px; - border: none; - border-bottom: 2px solid transparent; - margin-bottom: -1px; - background: none; - font: inherit; - font-weight: 600; - color: var(--muted); - cursor: pointer; - } - - .tabs button.active { - color: var(--primary); - border-bottom-color: var(--primary); - } - - .tab-panel { - padding-top: 14px; - } diff --git a/ui/src/routes/Settings.svelte b/ui/src/routes/Settings.svelte index 7a65888..9bb2c22 100644 --- a/ui/src/routes/Settings.svelte +++ b/ui/src/routes/Settings.svelte @@ -18,13 +18,12 @@ const services: { id: Service; name: string }[] = [ { id: 'deepscript', name: 'DeepScript' }, - { id: 'anthropic', name: 'Anthropic (Claude)' }, ] let settings = $state(null) let devices = $state({ inputs: [], outputs: [] }) - let keySaved = $state>({ deepscript: false, anthropic: false }) - let keyInput = $state>({ deepscript: '', anthropic: '' }) + let keySaved = $state>({ deepscript: false }) + let keyInput = $state>({ deepscript: '' }) let newApp = $state('') let testing = $state(false) let testResult = $state(null)