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) <noreply@anthropic.com>
This commit is contained in:
hauke
2026-11-06 14:35:41 +01:00
co-authored by Claude Opus 5.5
parent eff07d2f59
commit 54a81e5ba0
16 changed files with 72 additions and 417 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
# Gesprächsrekorder # Gesprächsrekorder
A Tauri 2 desktop app that records calls (Teams, MicroSIP, browser-based A Tauri 2 desktop app that records calls (Teams, MicroSIP, browser-based
softphones, …), then transcribes and summarizes them. softphones, …) and transcribes them.
## Workspace layout ## Workspace layout
- `crates/core` (`recorder-core`) — core domain logic: call detection, - `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 the Tauri app shell and the audio backend so it can be unit-tested without
a GUI, a sound device or network access. a GUI, a sound device or network access.
- `crates/audio` (`recorder-audio`) — audio capture and WAV/FLAC encoding. - `crates/audio` (`recorder-audio`) — audio capture and WAV/FLAC encoding.
-82
View File
@@ -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<Account> {
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(""));
}
}
+1 -6
View File
@@ -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 /// 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)] #[derive(Serialize, Clone, Debug, PartialEq)]
pub struct CallHeader { pub struct CallHeader {
#[serde(flatten)] #[serde(flatten)]
pub item: CallListItem, pub item: CallListItem,
pub error: Option<String>, pub error: Option<String>,
pub account_id: Option<String>,
} }
/// A transcript line with the speaker's display label. /// A transcript line with the speaker's display label.
@@ -115,7 +114,6 @@ impl CallDetail {
call: CallHeader { call: CallHeader {
item: CallListItem::of(call), item: CallListItem::of(call),
error: call.error.clone(), error: call.error.clone(),
account_id: call.account_id.clone(),
}, },
segments, segments,
merges: merge_views(merges, &speaker_names), merges: merge_views(merges, &speaker_names),
@@ -176,7 +174,6 @@ mod tests {
out_path: PathBuf::from("7-out.wav"), out_path: PathBuf::from("7-out.wav"),
transcribed_at: None, transcribed_at: None,
audio_deleted: false, audio_deleted: false,
account_id: None,
title: None, title: None,
} }
} }
@@ -330,7 +327,6 @@ mod tests {
let mut c = call(Some(at(10, 15, 0))); let mut c = call(Some(at(10, 15, 0)));
c.status = CallStatus::Failed; c.status = CallStatus::Failed;
c.error = Some("Netzwerkfehler".into()); c.error = Some("Netzwerkfehler".into());
c.account_id = Some("mock-2".into());
c.title = Some("Reklamation".into()); c.title = Some("Reklamation".into());
let merges = keys(&[("remote:2", "remote:1")]); let merges = keys(&[("remote:2", "remote:1")]);
@@ -349,7 +345,6 @@ mod tests {
"interrupted": false, "interrupted": false,
"title": "Reklamation", "title": "Reklamation",
"error": "Netzwerkfehler", "error": "Netzwerkfehler",
"account_id": "mock-2",
}, },
"segments": [], "segments": [],
"speaker_names": {}, "speaker_names": {},
+4 -5
View File
@@ -1,7 +1,6 @@
//! The HTTP transport seam: every outgoing request the DeepScript and Claude //! The HTTP transport seam: every outgoing request the API clients make goes
//! clients (Tasks 12/13) make goes through [`HttpTransport`], so unit tests //! through [`HttpTransport`], so unit tests can swap in
//! can swap in [`crate::testing::FakeTransport`] and run with the network //! [`crate::testing::FakeTransport`] and run with the network unplugged. [`ReqwestTransport`] is the real implementation, exercised only
//! unplugged. [`ReqwestTransport`] is the real implementation, exercised only
//! by the live integration suite (`crates/core/tests/live_api.rs`). //! by the live integration suite (`crates/core/tests/live_api.rs`).
use std::path::PathBuf; use std::path::PathBuf;
@@ -101,7 +100,7 @@ pub trait HttpTransport: Send + Sync {
/// Live `HttpTransport` backed by `reqwest` (rustls). Shares one /// Live `HttpTransport` backed by `reqwest` (rustls). Shares one
/// `reqwest::Client` (connection pooling) with a 10 minute request timeout /// `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. /// worst-case wait.
pub struct ReqwestTransport { pub struct ReqwestTransport {
client: reqwest::Client, client: reqwest::Client,
+3 -4
View File
@@ -1,10 +1,9 @@
//! Core domain logic for the Gesprächsrekorder call recorder. //! Core domain logic for the Gesprächsrekorder call recorder.
//! //!
//! This crate will grow to hold call detection, recording orchestration, //! Call detection, recording orchestration and transcription, kept
//! transcription and summarization logic, kept independent of the Tauri //! independent of the Tauri application shell so it can be unit-tested
//! application shell so it can be unit-tested without a GUI or network. //! without a GUI or network.
pub mod accounts;
pub mod audio; pub mod audio;
pub mod call_view; pub mod call_view;
pub mod capture; pub mod capture;
+1 -37
View File
@@ -3,7 +3,7 @@
use std::path::PathBuf; use std::path::PathBuf;
use chrono::{DateTime, Local, NaiveDate}; use chrono::{DateTime, Local};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Primary key of a `calls` row (SQLite `rowid`). /// Primary key of a `calls` row (SQLite `rowid`).
@@ -37,7 +37,6 @@ pub struct Call {
pub out_path: PathBuf, pub out_path: PathBuf,
pub transcribed_at: Option<DateTime<Local>>, pub transcribed_at: Option<DateTime<Local>>,
pub audio_deleted: bool, pub audio_deleted: bool,
pub account_id: Option<String>,
/// The name the user gave the call, if any. /// The name the user gave the call, if any.
pub title: Option<String>, pub title: Option<String>,
} }
@@ -97,38 +96,3 @@ pub struct Segment {
pub end: f64, pub end: f64,
pub text: String, 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<NaiveDate>,
#[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<NaiveDate>,
pub notiz: Option<String>,
}
/// Structured summary produced by Claude for a finished call.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct Summary {
pub kernpunkte: Vec<String>,
pub vereinbarungen: Vec<String>,
pub todos: Vec<Todo>,
pub naechster_kontakt: NaechsterKontakt,
}
-1
View File
@@ -108,7 +108,6 @@ async fn run(
// Jobs whose delete failed in an earlier run. // Jobs whose delete failed in an earlier run.
delete_remote_jobs(store, tr, id).await; delete_remote_jobs(store, tr, id).await;
} }
// SUMMARY SEAM (Task 14b): summarize here.
store.set_status(id, CallStatus::Done, None)?; store.set_status(id, CallStatus::Done, None)?;
log::info!("call {id}: done"); log::info!("call {id}: done");
Ok(()) Ok(())
+1 -2
View File
@@ -10,7 +10,7 @@ use crate::model::{Call, CallId, CallStatus};
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RetentionAction { pub enum RetentionAction {
/// Delete the call's audio file(s) on disk; the row stays (it has a /// Delete the call's audio file(s) on disk; the row stays (it has a
/// summary/transcript worth keeping). /// transcript worth keeping).
DeleteAudio(CallId), DeleteAudio(CallId),
/// Delete the whole call row (and everything derived from it). /// Delete the whole call row (and everything derived from it).
DeleteCall(CallId), DeleteCall(CallId),
@@ -88,7 +88,6 @@ mod tests {
out_path: PathBuf::from("/tmp/out.wav"), out_path: PathBuf::from("/tmp/out.wav"),
transcribed_at: None, transcribed_at: None,
audio_deleted: false, audio_deleted: false,
account_id: None,
title: None, title: None,
} }
} }
+29 -4
View File
@@ -15,7 +15,6 @@ pub const KEYRING_SERVICE: &str = "eu.euvino.callrecorder";
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum Service { pub enum Service {
DeepScript, DeepScript,
Anthropic,
} }
impl Service { impl Service {
@@ -23,7 +22,6 @@ impl Service {
pub fn user(self) -> &'static str { pub fn user(self) -> &'static str {
match self { match self {
Service::DeepScript => "deepscript", Service::DeepScript => "deepscript",
Service::Anthropic => "anthropic",
} }
} }
} }
@@ -45,6 +43,10 @@ pub trait SecretStore: Send + Sync {
fn delete(&self, s: Service) -> Result<()>; 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. /// The OS keyring.
pub struct KeyringSecrets; pub struct KeyringSecrets;
@@ -53,6 +55,21 @@ impl KeyringSecrets {
keyring::Entry::new(KEYRING_SERVICE, s.user()) keyring::Entry::new(KEYRING_SERVICE, s.user())
.map_err(|e| SecretError::Keyring(e.to_string())) .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 { impl SecretStore for KeyringSecrets {
@@ -100,6 +117,8 @@ impl SecretStore for MemorySecrets {
mod tests { mod tests {
use super::*; use super::*;
const SERVICES: &[Service] = &[Service::DeepScript];
#[test] #[test]
fn memory_secrets_roundtrip() { fn memory_secrets_roundtrip() {
let secrets = MemorySecrets::default(); let secrets = MemorySecrets::default();
@@ -107,16 +126,22 @@ mod tests {
secrets.set(Service::DeepScript, "ds-key").unwrap(); secrets.set(Service::DeepScript, "ds-key").unwrap();
assert_eq!(secrets.get(Service::DeepScript).as_deref(), Some("ds-key")); assert_eq!(secrets.get(Service::DeepScript).as_deref(), Some("ds-key"));
assert_eq!(secrets.get(Service::Anthropic), None);
secrets.delete(Service::DeepScript).unwrap(); secrets.delete(Service::DeepScript).unwrap();
assert_eq!(secrets.get(Service::DeepScript), None); assert_eq!(secrets.get(Service::DeepScript), None);
secrets.delete(Service::DeepScript).unwrap(); 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] #[test]
fn service_serializes_as_keyring_user() { 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(); let json = serde_json::to_string(&s).unwrap();
assert_eq!(json, format!("\"{}\"", s.user())); assert_eq!(json, format!("\"{}\"", s.user()));
assert_eq!(serde_json::from_str::<Service>(&json).unwrap(), s); assert_eq!(serde_json::from_str::<Service>(&json).unwrap(), s);
+18 -104
View File
@@ -1,5 +1,5 @@
//! SQLite-backed persistence for calls, their transcripts, summaries, //! SQLite-backed persistence for calls, their transcripts, speaker renames
//! speaker renames and outstanding remote transcription/summary jobs. //! and merges, and outstanding remote transcription jobs.
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@@ -10,7 +10,7 @@ use rusqlite::{params, Connection, Row, TransactionBehavior};
use thiserror::Error; use thiserror::Error;
use crate::merge::{self, MergeError}; 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. /// Longest call title, in characters.
const MAX_TITLE_CHARS: usize = 120; const MAX_TITLE_CHARS: usize = 120;
@@ -22,8 +22,8 @@ pub enum StoreError {
Sqlite(#[from] rusqlite::Error), Sqlite(#[from] rusqlite::Error),
/// A value read back from SQLite could not be interpreted, e.g. an /// A value read back from SQLite could not be interpreted, e.g. an
/// unknown `status` string, invalid RFC 3339 timestamp, unparsable /// unknown `status` string, invalid RFC 3339 timestamp or unparsable
/// speaker key or malformed summary JSON. /// speaker key.
#[error("corrupt stored value: {0}")] #[error("corrupt stored value: {0}")]
Corrupt(String), Corrupt(String),
@@ -51,7 +51,9 @@ pub struct RecoveryReport {
pub failed: Vec<CallId>, pub failed: Vec<CallId>,
} }
/// 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 = " const SCHEMA_V1_SQL: &str = "
CREATE TABLE IF NOT EXISTS calls ( CREATE TABLE IF NOT EXISTS calls (
id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -152,8 +154,8 @@ impl Store {
let conn = self.conn.lock().unwrap(); let conn = self.conn.lock().unwrap();
conn.execute( conn.execute(
"INSERT INTO calls \ "INSERT INTO calls \
(app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, account_id) \ (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, NULL)", VALUES (?1, ?2, NULL, ?3, 0, NULL, ?4, ?5, NULL, 0)",
params![ params![
app, app,
dt_to_str(started_at), dt_to_str(started_at),
@@ -271,33 +273,6 @@ impl Store {
Ok(segments) 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<Option<Summary>> {
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<()> { pub fn set_speaker_name(&self, id: CallId, speaker_key: &str, name: &str) -> Result<()> {
let conn = self.conn.lock().unwrap(); let conn = self.conn.lock().unwrap();
conn.execute( conn.execute(
@@ -398,8 +373,9 @@ impl Store {
Ok(()) Ok(())
} }
/// Deletes a call and every row derived from it (segments, summary, /// Deletes a call and every row derived from it (segments, speaker
/// speaker names and merges, remote jobs). /// names and merges, remote jobs; also the `summaries` table of schema
/// v1, which nothing writes).
pub fn delete_call(&self, id: CallId) -> Result<()> { pub fn delete_call(&self, id: CallId) -> Result<()> {
let mut conn = self.conn.lock().unwrap(); let mut conn = self.conn.lock().unwrap();
let tx = conn.transaction()?; let tx = conn.transaction()?;
@@ -413,15 +389,6 @@ impl Store {
Ok(()) 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<()> { pub fn record_remote_job(&self, id: CallId, track: &str, remote_id: &str) -> Result<()> {
let conn = self.conn.lock().unwrap(); let conn = self.conn.lock().unwrap();
conn.execute( conn.execute(
@@ -470,7 +437,7 @@ impl Store {
/// `AwaitingDecision`, with `interrupted` set and `ended_at` set to now /// `AwaitingDecision`, with `interrupted` set and `ended_at` set to now
/// if it was not already set (a later pass corrects it from the WAV /// if it was not already set (a later pass corrects it from the WAV
/// length). /// length).
/// - `Processing` calls were mid-transcription/summarization: they move /// - `Processing` calls were mid-transcription: they move
/// to `Failed` with a fixed error message. /// to `Failed` with a fixed error message.
/// ///
/// Both updates run in a single transaction. /// Both updates run in a single transaction.
@@ -547,9 +514,9 @@ fn ids_with_status(conn: &rusqlite::Connection, status: CallStatus) -> Result<Ve
Ok(ids) Ok(ids)
} }
const SELECT_ALL_CALLS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, account_id, title FROM calls"; const SELECT_ALL_CALLS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, title FROM calls";
const SELECT_CALL_COLUMNS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, account_id, title FROM calls WHERE id = ?1"; const SELECT_CALL_COLUMNS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, title FROM calls WHERE id = ?1";
fn row_to_call(row: &Row) -> Result<Call> { fn row_to_call(row: &Row) -> Result<Call> {
let id: CallId = row.get(0)?; let id: CallId = row.get(0)?;
@@ -563,8 +530,7 @@ fn row_to_call(row: &Row) -> Result<Call> {
let out_path: String = row.get(8)?; let out_path: String = row.get(8)?;
let transcribed_at: Option<String> = row.get(9)?; let transcribed_at: Option<String> = row.get(9)?;
let audio_deleted: bool = row.get(10)?; let audio_deleted: bool = row.get(10)?;
let account_id: Option<String> = row.get(11)?; let title: Option<String> = row.get(11)?;
let title: Option<String> = row.get(12)?;
Ok(Call { Ok(Call {
id, id,
@@ -578,7 +544,6 @@ fn row_to_call(row: &Row) -> Result<Call> {
out_path: PathBuf::from(out_path), out_path: PathBuf::from(out_path),
transcribed_at: opt_dt_from_str(transcribed_at)?, transcribed_at: opt_dt_from_str(transcribed_at)?,
audio_deleted, audio_deleted,
account_id,
title, title,
}) })
} }
@@ -637,9 +602,7 @@ mod tests {
use chrono::Local; use chrono::Local;
use crate::model::{ use crate::model::{CallId, CallStatus, Segment, Speaker};
CallId, CallStatus, NaechsterKontakt, Owner, Segment, Speaker, Summary, Todo,
};
use crate::store::Store; use crate::store::Store;
/// The schema of user_version 1, exactly as the first release created /// 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"); let call = store.get_call(1).unwrap().expect("call kept");
assert_eq!(call.app, "Microsoft Teams"); assert_eq!(call.app, "Microsoft Teams");
assert_eq!(call.status, CallStatus::Done); 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.mic_path, PathBuf::from("/rec/1-mic.wav"));
assert_eq!(call.title, None); assert_eq!(call.title, None);
let texts: Vec<_> = store let texts: Vec<_> = store
@@ -939,38 +901,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs (
assert_eq!(store.segments(id).unwrap(), second); 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] #[test]
fn speaker_names_upsert() { fn speaker_names_upsert() {
let store = Store::open_in_memory().unwrap(); let store = Store::open_in_memory().unwrap();
@@ -1167,21 +1097,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs (
}], }],
) )
.unwrap(); .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_name(id, "me", "Ich").unwrap();
store.set_speaker_merge(id, "remote:2", "remote:1").unwrap(); store.set_speaker_merge(id, "remote:2", "remote:1").unwrap();
store store
@@ -1192,7 +1107,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs (
assert_eq!(store.get_call(id).unwrap(), None); assert_eq!(store.get_call(id).unwrap(), None);
assert_eq!(store.segments(id).unwrap(), Vec::new()); 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.speaker_names(id).unwrap(), BTreeMap::new());
assert_eq!(store.remote_jobs(id).unwrap(), Vec::new()); assert_eq!(store.remote_jobs(id).unwrap(), Vec::new());
assert_eq!(store.speaker_merges(id).unwrap(), BTreeMap::new()); assert_eq!(store.speaker_merges(id).unwrap(), BTreeMap::new());
-16
View File
@@ -8,7 +8,6 @@
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use recorder_core::accounts::{self, Account};
use recorder_core::call_view::{CallDetail, CallListItem}; use recorder_core::call_view::{CallDetail, CallListItem};
use recorder_core::capture::Devices; use recorder_core::capture::Devices;
use recorder_core::model::CallId; use recorder_core::model::CallId;
@@ -186,21 +185,6 @@ pub fn rename_call(
Ok(()) Ok(())
} }
#[tauri::command]
pub fn list_accounts() -> Vec<Account> {
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<String>,
) -> CmdResult<()> {
state.set_account(id, account_id.as_deref())
}
/// Deletes a finished call's audio and row. Closes the prompt if no call /// 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. /// 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 /// While its DeepScript jobs are still on record, nothing is deleted and a
+2 -2
View File
@@ -83,6 +83,8 @@ pub fn run() {
&config_dir.join("last-version"), &config_dir.join("last-version"),
&app.package_info().version.to_string(), &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. // Before anything can start a run.
processing::clear_upload_dir(app.handle()); processing::clear_upload_dir(app.handle());
app.manage(state); app.manage(state);
@@ -137,8 +139,6 @@ pub fn run() {
commands::merge_speakers, commands::merge_speakers,
commands::unmerge_speaker, commands::unmerge_speaker,
commands::rename_call, commands::rename_call,
commands::list_accounts,
commands::set_account,
updater::get_update, updater::get_update,
updater::install_update, updater::install_update,
]) ])
-36
View File
@@ -17,7 +17,6 @@ use std::time::{Duration, Instant};
use chrono::{DateTime, Local}; use chrono::{DateTime, Local};
use recorder_audio::RenderSession; use recorder_audio::RenderSession;
use recorder_core::accounts;
use recorder_core::call_view::{self, CallDetail, CallListItem}; use recorder_core::call_view::{self, CallDetail, CallListItem};
use recorder_core::capture::{CaptureSource, OutputTarget}; use recorder_core::capture::{CaptureSource, OutputTarget};
use recorder_core::detect::{CallDetector, DetectorEvent, MicSession}; 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()) 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<Call, String> { fn find_call(&self, id: CallId) -> Result<Call, String> {
self.store self.store
.get_call(id) .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] #[test]
fn invalid_detection_delays_are_not_saved() { fn invalid_detection_delays_are_not_saved() {
let f = fixture(); let f = fixture();
+2 -10
View File
@@ -17,7 +17,7 @@ export interface Settings {
end_after_secs: number end_after_secs: number
} }
export type Service = 'deepscript' | 'anthropic' export type Service = 'deepscript'
export interface DeviceInfo { export interface DeviceInfo {
id: string id: string
@@ -87,7 +87,7 @@ export interface SpeakerMerge {
} }
export interface CallDetail { export interface CallDetail {
call: CallListItem & { error: string | null; account_id: string | null } call: CallListItem & { error: string | null }
/** The transcript with speaker merges applied. */ /** The transcript with speaker merges applied. */
segments: SegmentView[] segments: SegmentView[]
/** Renamed speakers by key. */ /** Renamed speakers by key. */
@@ -95,11 +95,6 @@ export interface CallDetail {
merges: SpeakerMerge[] merges: SpeakerMerge[]
} }
export interface Account {
id: string
name: string
}
/** A newer version the release feed offers. */ /** A newer version the release feed offers. */
export interface UpdateInfo { export interface UpdateInfo {
version: string version: string
@@ -149,9 +144,6 @@ export const unmergeSpeaker = (id: CallId, fromKey: string) =>
/** `null` or an empty title restores the default heading. */ /** `null` or an empty title restores the default heading. */
export const renameCall = (id: CallId, title: string | null) => export const renameCall = (id: CallId, title: string | null) =>
invoke<void>('rename_call', { id, title }) invoke<void>('rename_call', { id, title })
export const listAccounts = () => invoke<Account[]>('list_accounts')
export const setAccount = (id: CallId, accountId: string | null) =>
invoke<void>('set_account', { id, accountId })
export const getUpdate = () => invoke<UpdateInfo | null>('get_update') export const getUpdate = () => invoke<UpdateInfo | null>('get_update')
/** Resolves only on failure: on success the app restarts. */ /** Resolves only on failure: on success the app restarts. */
export const installUpdate = () => invoke<void>('install_update') export const installUpdate = () => invoke<void>('install_update')
-96
View File
@@ -5,7 +5,6 @@
errorText, errorText,
getCall, getCall,
getRecordingState, getRecordingState,
listAccounts,
listCalls, listCalls,
mergeSpeakers, mergeSpeakers,
onCallEnded, onCallEnded,
@@ -15,12 +14,10 @@
renameCall, renameCall,
renameSpeaker, renameSpeaker,
retryCall, retryCall,
setAccount,
showRecorder, showRecorder,
startManualRecording, startManualRecording,
transcribeCall, transcribeCall,
unmergeSpeaker, unmergeSpeaker,
type Account,
type CallDetail, type CallDetail,
type CallId, type CallId,
type CallListItem, type CallListItem,
@@ -35,7 +32,6 @@
let calls = $state<CallListItem[]>([]) let calls = $state<CallListItem[]>([])
let loaded = $state(false) let loaded = $state(false)
let listError = $state('') let listError = $state('')
let accounts = $state<Account[]>([])
let recordingState = $state<RecordingState>({ state: 'idle' }) let recordingState = $state<RecordingState>({ state: 'idle' })
let recordBusy = $state(false) let recordBusy = $state(false)
@@ -46,7 +42,6 @@
let detailError = $state('') let detailError = $state('')
let actionError = $state('') let actionError = $state('')
let busy = $state(false) let busy = $state(false)
let tab = $state<'summary' | 'transcript'>('transcript')
let editingTitle = $state(false) let editingTitle = $state(false)
let titleDraft = $state('') let titleDraft = $state('')
@@ -132,9 +127,6 @@
getRecordingState() getRecordingState()
.then((state) => (recordingState = state)) .then((state) => (recordingState = state))
.catch((err) => (recordError = errorText(err))) .catch((err) => (recordError = errorText(err)))
listAccounts()
.then((list) => (accounts = list))
.catch((err) => (listError = errorText(err)))
return () => unlisten.forEach((u) => u.then((off) => off())) return () => unlisten.forEach((u) => u.then((off) => off()))
}) })
@@ -186,20 +178,6 @@
refreshList() 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) { async function rename(speakerKey: string, name: string) {
if (!detail) return if (!detail) return
await renameSpeaker(detail.call.id, speakerKey, name) await renameSpeaker(detail.call.id, speakerKey, name)
@@ -256,13 +234,6 @@
return parts.join(' · ') 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 // A failed start (e.g. missing key) also marks the call failed; its
// error is then shown once, in the failure box. // error is then shown once, in the failure box.
let shownActionError = $derived(actionError !== detail?.call.error ? actionError : '') let shownActionError = $derived(actionError !== detail?.call.error ? actionError : '')
@@ -332,15 +303,6 @@
<p class="error">{titleError}</p> <p class="error">{titleError}</p>
{/if} {/if}
<div class="toolbar"> <div class="toolbar">
<label class="customer">
<span>Kunde:</span>
<select value={call.account_id ?? ''} disabled={busy} onchange={changeAccount}>
<option value="">— kein Kunde —</option>
{#each accountOptions as account (account.id)}
<option value={account.id}>{account.name}</option>
{/each}
</select>
</label>
<span class="actions"> <span class="actions">
{#if call.status === 'awaiting_decision'} {#if call.status === 'awaiting_decision'}
<button class="btn primary" disabled={busy} onclick={transcribe}>Transkribieren</button> <button class="btn primary" disabled={busy} onclick={transcribe}>Transkribieren</button>
@@ -376,24 +338,6 @@
<strong>Verarbeitung fehlgeschlagen</strong> <strong>Verarbeitung fehlgeschlagen</strong>
<div>{call.error ?? 'Unbekannter Fehler'}</div> <div>{call.error ?? 'Unbekannter Fehler'}</div>
</div> </div>
{:else}
<div class="tabs" role="tablist">
<button
role="tab"
aria-selected={tab === 'summary'}
class:active={tab === 'summary'}
onclick={() => (tab = 'summary')}>Zusammenfassung</button
>
<button
role="tab"
aria-selected={tab === 'transcript'}
class:active={tab === 'transcript'}
onclick={() => (tab = 'transcript')}>Transkript</button
>
</div>
<div class="tab-panel" role="tabpanel">
{#if tab === 'summary'}
<p class="muted">Die Zusammenfassung kommt in einer späteren Version.</p>
{:else} {:else}
<TranscriptView <TranscriptView
segments={detail.segments} segments={detail.segments}
@@ -404,8 +348,6 @@
/> />
{/if} {/if}
</div> </div>
{/if}
</div>
{:else if detailError} {:else if detailError}
<p class="error pad">{detailError}</p> <p class="error pad">{detailError}</p>
{:else if loaded && selectedId === null && calls.length > 0} {:else if loaded && selectedId === null && calls.length > 0}
@@ -552,17 +494,6 @@
margin-top: 12px; margin-top: 12px;
} }
.customer {
display: inline-flex;
align-items: center;
gap: 8px;
font-weight: 600;
}
.customer select {
max-width: 260px;
}
.actions { .actions {
display: inline-flex; display: inline-flex;
gap: 8px; gap: 8px;
@@ -588,31 +519,4 @@
background: var(--rec-soft); background: var(--rec-soft);
color: var(--rec); 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;
}
</style> </style>
+2 -3
View File
@@ -18,13 +18,12 @@
const services: { id: Service; name: string }[] = [ const services: { id: Service; name: string }[] = [
{ id: 'deepscript', name: 'DeepScript' }, { id: 'deepscript', name: 'DeepScript' },
{ id: 'anthropic', name: 'Anthropic (Claude)' },
] ]
let settings = $state<Settings | null>(null) let settings = $state<Settings | null>(null)
let devices = $state<Devices>({ inputs: [], outputs: [] }) let devices = $state<Devices>({ inputs: [], outputs: [] })
let keySaved = $state<Record<Service, boolean>>({ deepscript: false, anthropic: false }) let keySaved = $state<Record<Service, boolean>>({ deepscript: false })
let keyInput = $state<Record<Service, string>>({ deepscript: '', anthropic: '' }) let keyInput = $state<Record<Service, string>>({ deepscript: '' })
let newApp = $state('') let newApp = $state('')
let testing = $state(false) let testing = $state(false)
let testResult = $state<DeviceLevels | null>(null) let testResult = $state<DeviceLevels | null>(null)