update dependencies

This commit is contained in:
2026-07-19 11:16:10 +02:00
parent 78ba2b7b3d
commit 06ef1ba2dd
11 changed files with 478 additions and 654 deletions
+2 -2
View File
@@ -8,13 +8,13 @@ license = "GPL-3.0"
ollama-rs = {version = "0.3.4", features = ["macros", "headers"]}
reqwest = { version = "0.13.2", features = ["stream", "multipart", "form"] }
tokio = { version = "1.50.0", features = ["rt", "rt-multi-thread", "macros"] }
rmcp = {version="1.3.0", features = ["transport-streamable-http-client-reqwest", "reqwest", "client", "auth", "transport-child-process"]}
rmcp = {version="2.2.0", features = ["transport-streamable-http-client-reqwest", "reqwest", "client", "auth", "transport-child-process"]}
log = {version = "0.4.29"}
env_logger = "0.11.10"
serde = { version = "1.0.228", features = ["derive"] }
thiserror = "2.0.17"
url = "2.5.8"
rand = "0.10.0"
cpal = "0.17.3"
cpal = "0.18.1"
hound = "3.5.1"
bytes = "1.11.1"
+11 -13
View File
@@ -1,5 +1,5 @@
use cpal::traits::{DeviceTrait, StreamTrait};
use cpal::{BuildStreamError, Device, SampleFormat, SizedSample, Stream, SupportedStreamConfig};
use cpal::{Device, Error, SampleFormat, SizedSample, Stream, SupportedStreamConfig};
use hound::WavSpec;
use log::{debug, error, info, trace};
use std::fmt::Debug;
@@ -38,9 +38,9 @@ fn build_stream<T: SizedSample + Debug + hound::Sample + Send + Into<f64>>(
device_config: SupportedStreamConfig,
samples: SampleArc,
sample_format: SampleFormat,
) -> Result<Stream, BuildStreamError> {
) -> Result<Stream, Error> {
mic.build_input_stream(
&device_config.into(),
device_config.into(),
move |input: &[T], _info| stream_callback::<T>(input, samples.clone(), sample_format),
|e| {
error!("a stream error occurred while trying to record: {:?}", e);
@@ -70,9 +70,7 @@ pub enum RecordingError {
#[error("unsupported sample format")]
UnsupportedSampleFormat(SampleFormat),
#[error(transparent)]
PlayStreamError(#[from] cpal::PlayStreamError),
#[error(transparent)]
BuildStreamError(#[from] BuildStreamError),
StreamError(#[from] cpal::Error),
#[error("thread poisoned")]
ThreadPoison,
#[error("recording was already stopped")]
@@ -81,23 +79,23 @@ pub enum RecordingError {
fn start_recording_blocking_with_parameters(
mic: &Device,
device_config: &SupportedStreamConfig,
device_config: SupportedStreamConfig,
sample_format: SampleFormat,
samples: SampleArc,
should_stop: Arc<Mutex<bool>>,
) -> Result<(), RecordingError> {
let stream = match sample_format {
SampleFormat::I8 => {
build_stream::<i8>(mic, device_config.clone(), samples.clone(), sample_format)?
build_stream::<i8>(mic, device_config, samples.clone(), sample_format)?
}
SampleFormat::I16 => {
build_stream::<i16>(mic, device_config.clone(), samples.clone(), sample_format)?
build_stream::<i16>(mic, device_config, samples.clone(), sample_format)?
}
SampleFormat::I32 => {
build_stream::<i32>(mic, device_config.clone(), samples.clone(), sample_format)?
build_stream::<i32>(mic, device_config, samples.clone(), sample_format)?
}
SampleFormat::F32 => {
build_stream::<f32>(mic, device_config.clone(), samples.clone(), sample_format)?
build_stream::<f32>(mic, device_config, samples.clone(), sample_format)?
}
sample_format => {
return Err(RecordingError::UnsupportedSampleFormat(sample_format));
@@ -135,11 +133,11 @@ pub fn start(
let thread_samples = samples.clone();
let thread_recording_stop = recording_should_stop.clone();
let thread_device_config = device_config.clone();
let thread_device_config = device_config;
let record_thread_handle = thread::spawn(move || {
start_recording_blocking_with_parameters(
&microphone,
&thread_device_config,
thread_device_config,
sample_format,
thread_samples,
thread_recording_stop,
+12 -6
View File
@@ -1,6 +1,6 @@
use crate::mcp::MCPClient;
use ollama_rs::Ollama;
use ollama_rs::error::{OllamaError};
use ollama_rs::error::OllamaError;
use ollama_rs::generation::chat::ChatMessage;
use ollama_rs::generation::chat::request::ChatMessageRequest;
use ollama_rs::generation::completion::request::GenerationRequest;
@@ -102,13 +102,13 @@ pub enum ChatError {
#[derive(Debug, Clone)]
pub enum RestrictedToolCallResult {
Granted(CallToolResult),
Denied
Denied,
}
#[derive(Debug, Clone)]
pub struct ToolUsage {
pub call: ToolCall,
pub result: RestrictedToolCallResult
pub result: RestrictedToolCallResult,
}
impl AgentChat {
@@ -255,10 +255,14 @@ impl AgentChat {
.call_tool(tool_call, &mut permission_request_callback)
.await?;
tool_usages.push(ToolUsage{call: tool_call.clone(), result: restricted_result.clone()});
tool_usages.push(ToolUsage {
call: tool_call.clone(),
result: restricted_result.clone(),
});
// serialize structured content if it exists
if let RestrictedToolCallResult::Granted(result) = restricted_result.clone() && let Some(structured_content) = result.structured_content
if let RestrictedToolCallResult::Granted(result) = restricted_result.clone()
&& let Some(structured_content) = result.structured_content
{
log::debug!("structured content: {structured_content:#?}");
@@ -272,7 +276,9 @@ impl AgentChat {
.filter_map(|content| content.as_text())
.map(|text_content| text_content.text.clone())
.collect::<Vec<_>>(),
RestrictedToolCallResult::Denied => vec![String::from("Tool Permission Denied by the user")],
RestrictedToolCallResult::Denied => {
vec![String::from("Tool Permission Denied by the user")]
}
};
log::debug!("contents: {contents:#?}");