Compare commits
3
Commits
445cd3d011
...
e90efbb544
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e90efbb544 | ||
|
|
c5b594e1da | ||
|
|
b776cafab7 |
Generated
+23
-6
@@ -1550,7 +1550,7 @@ dependencies = [
|
||||
"hyper-util",
|
||||
"icalendar",
|
||||
"libdav",
|
||||
"own_assist_common 0.3.0 (sparse+https://git.mboemer.de/api/packages/milan/cargo/)",
|
||||
"own_assist_common 0.3.0",
|
||||
"rmcp",
|
||||
"serde",
|
||||
"thiserror 2.0.19",
|
||||
@@ -1576,7 +1576,7 @@ dependencies = [
|
||||
"hyper-util",
|
||||
"icalendar",
|
||||
"libdav",
|
||||
"own_assist_common 0.3.0 (sparse+https://git.mboemer.de/api/packages/milan/cargo/)",
|
||||
"own_assist_common 0.3.0",
|
||||
"rmcp",
|
||||
"serde",
|
||||
"thiserror 2.0.19",
|
||||
@@ -1998,7 +1998,7 @@ dependencies = [
|
||||
"log",
|
||||
"mcp_server_collection 0.2.2 (sparse+https://git.mboemer.de/api/packages/milan/cargo/)",
|
||||
"ollama-rs",
|
||||
"own_assist_common 0.3.0 (sparse+https://git.mboemer.de/api/packages/milan/cargo/)",
|
||||
"own_assist_common 0.4.1 (sparse+https://git.mboemer.de/api/packages/milan/cargo/)",
|
||||
"own_mcp 0.1.1 (sparse+https://git.mboemer.de/api/packages/milan/cargo/)",
|
||||
"rmcp",
|
||||
"rodio",
|
||||
@@ -2012,6 +2012,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "own_assist_common"
|
||||
version = "0.3.0"
|
||||
source = "sparse+https://git.mboemer.de/api/packages/milan/cargo/"
|
||||
checksum = "e4f114c598d4f9b1c26def3a047fbba893a202bb2a91be6f21d80881320ad872"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
@@ -2022,15 +2024,30 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "own_assist_common"
|
||||
version = "0.3.0"
|
||||
source = "sparse+https://git.mboemer.de/api/packages/milan/cargo/"
|
||||
checksum = "e4f114c598d4f9b1c26def3a047fbba893a202bb2a91be6f21d80881320ad872"
|
||||
version = "0.4.1"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ollama-rs",
|
||||
"serde",
|
||||
"thiserror 2.0.19",
|
||||
"toml",
|
||||
"tracing-subscriber",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "own_assist_common"
|
||||
version = "0.4.1"
|
||||
source = "sparse+https://git.mboemer.de/api/packages/milan/cargo/"
|
||||
checksum = "324156da8ebc00f6d5b6bd7709ffdf4dfe56bb0bb274315c133060d59ac8212b"
|
||||
dependencies = [
|
||||
"log",
|
||||
"ollama-rs",
|
||||
"serde",
|
||||
"thiserror 2.0.19",
|
||||
"toml",
|
||||
"tracing-subscriber",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ log = { version = "0.4.29" }
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
url = "2.5.8"
|
||||
own_mcp = { version = "0.1.1", registry = "gitea" }
|
||||
own_assist_common = { version = "0.3.0", registry = "gitea" }
|
||||
own_assist_common = { version = "0.4.1", registry = "gitea" }
|
||||
mcp_server_collection = { version = "0.2.0", registry = "gitea", optional = true}
|
||||
thiserror = "2.0.18"
|
||||
dialoguer = "0.12.0"
|
||||
|
||||
+25
-23
@@ -44,13 +44,13 @@
|
||||
|
||||
<h2>Overview of licenses:</h2>
|
||||
<ul class="licenses-overview">
|
||||
<li><a href="#Apache-2.0">Apache License 2.0</a> (250)</li>
|
||||
<li><a href="#Apache-2.0">Apache License 2.0</a> (251)</li>
|
||||
<li><a href="#MIT">MIT License</a> (77)</li>
|
||||
<li><a href="#Unicode-3.0">Unicode License v3</a> (19)</li>
|
||||
<li><a href="#MPL-2.0">Mozilla Public License 2.0</a> (12)</li>
|
||||
<li><a href="#BSD-3-Clause">BSD 3-Clause "New" or "Revised" License</a> (7)</li>
|
||||
<li><a href="#GPL-3.0">GNU General Public License v3.0 only</a> (5)</li>
|
||||
<li><a href="#ISC">ISC License</a> (5)</li>
|
||||
<li><a href="#GPL-3.0">GNU General Public License v3.0 only</a> (4)</li>
|
||||
<li><a href="#CDLA-Permissive-2.0">Community Data License Agreement Permissive 2.0</a> (2)</li>
|
||||
<li><a href="#Zlib">zlib License</a> (1)</li>
|
||||
</ul>
|
||||
@@ -64,6 +64,7 @@
|
||||
<li><a href=" https://github.com/tormol/encode_unicode ">encode_unicode 1.0.0</a></li>
|
||||
<li><a href=" https://github.com/hsivonen/encoding_rs ">encoding_rs 0.8.35</a></li>
|
||||
<li><a href=" https://github.com/ruuda/hound ">hound 3.5.1</a></li>
|
||||
<li><a href=" https://github.com/4t145/sse-stream/ ">sse-stream 0.2.5</a></li>
|
||||
<li><a href=" https://github.com/nvzqz/static-assertions-rs ">static_assertions 1.1.0</a></li>
|
||||
<li><a href=" https://github.com/hsivonen/utf8_iter ">utf8_iter 1.0.4</a></li>
|
||||
<li><a href=" https://github.com/RustCrypto/utils ">zeroize 1.9.0</a></li>
|
||||
@@ -506,7 +507,7 @@
|
||||
<h3 id="Apache-2.0">Apache License 2.0</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/google/zerocopy ">zerocopy 0.8.54</a></li>
|
||||
<li><a href=" https://github.com/google/zerocopy ">zerocopy 0.8.55</a></li>
|
||||
</ul>
|
||||
<pre class="license-text"> Apache License
|
||||
Version 2.0, January 2004
|
||||
@@ -1559,9 +1560,9 @@
|
||||
<li><a href=" https://github.com/rust-cli/anstyle.git ">anstyle-query 1.1.5</a></li>
|
||||
<li><a href=" https://github.com/rust-cli/anstyle.git ">anstyle-wincon 3.0.11</a></li>
|
||||
<li><a href=" https://github.com/rust-cli/anstyle.git ">anstyle 1.0.14</a></li>
|
||||
<li><a href=" https://github.com/clap-rs/clap ">clap 4.6.2</a></li>
|
||||
<li><a href=" https://github.com/clap-rs/clap ">clap 4.6.4</a></li>
|
||||
<li><a href=" https://github.com/clap-rs/clap ">clap_builder 4.6.2</a></li>
|
||||
<li><a href=" https://github.com/clap-rs/clap ">clap_derive 4.6.1</a></li>
|
||||
<li><a href=" https://github.com/clap-rs/clap ">clap_derive 4.6.4</a></li>
|
||||
<li><a href=" https://github.com/clap-rs/clap ">clap_lex 1.1.0</a></li>
|
||||
<li><a href=" https://github.com/rust-cli/anstyle.git ">colorchoice 1.0.5</a></li>
|
||||
<li><a href=" https://github.com/rust-cli/env_logger ">env_filter 2.0.0</a></li>
|
||||
@@ -3472,7 +3473,7 @@ limitations under the License.
|
||||
<h3 id="Apache-2.0">Apache License 2.0</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/rustls/pki-types ">rustls-pki-types 1.15.0</a></li>
|
||||
<li><a href=" https://github.com/rustls/pki-types ">rustls-pki-types 1.15.1</a></li>
|
||||
</ul>
|
||||
<pre class="license-text"> Apache License
|
||||
Version 2.0, January 2004
|
||||
@@ -3685,10 +3686,11 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/smol-rs/atomic-waker ">atomic-waker 1.1.2</a></li>
|
||||
<li><a href=" https://github.com/cuviper/autocfg ">autocfg 1.5.1</a></li>
|
||||
<li><a href=" https://github.com/marshallpierce/rust-base64 ">base64 0.22.1</a></li>
|
||||
<li><a href=" https://github.com/marshallpierce/rust-base64 ">base64 0.23.0</a></li>
|
||||
<li><a href=" https://github.com/bitflags/bitflags ">bitflags 1.3.2</a></li>
|
||||
<li><a href=" https://github.com/bitflags/bitflags ">bitflags 2.13.1</a></li>
|
||||
<li><a href=" https://github.com/fitzgen/bumpalo ">bumpalo 3.20.3</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cc-rs ">cc 1.3.0</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cc-rs ">cc 1.4.0</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cfg-if ">cfg-if 1.0.4</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cmake-rs ">cmake 0.1.58</a></li>
|
||||
<li><a href=" https://github.com/servo/core-foundation-rs ">core-foundation-sys 0.8.7</a></li>
|
||||
@@ -3698,7 +3700,7 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/yaahc/displaydoc ">displaydoc 0.2.6</a></li>
|
||||
<li><a href=" https://github.com/indexmap-rs/equivalent ">equivalent 1.0.2</a></li>
|
||||
<li><a href=" https://github.com/lambda-fairy/rust-errno ">errno 0.3.14</a></li>
|
||||
<li><a href=" https://github.com/smol-rs/fastrand ">fastrand 2.4.1</a></li>
|
||||
<li><a href=" https://github.com/smol-rs/fastrand ">fastrand 2.5.0</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cc-rs ">find-msvc-tools 0.1.9</a></li>
|
||||
<li><a href=" https://github.com/servo/rust-fnv ">fnv 1.0.7</a></li>
|
||||
<li><a href=" https://github.com/servo/rust-url ">form_urlencoded 1.2.2</a></li>
|
||||
@@ -5013,7 +5015,7 @@ limitations under the License.
|
||||
<h3 id="Apache-2.0">Apache License 2.0</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/Lokathor/bytemuck ">bytemuck 1.25.1</a></li>
|
||||
<li><a href=" https://github.com/Lokathor/bytemuck ">bytemuck 1.25.2</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">Apache License
|
||||
Version 2.0, January 2004
|
||||
@@ -5305,7 +5307,7 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/jni-rs/jni-rs ">jni-macros 0.22.4</a></li>
|
||||
<li><a href=" https://github.com/jni-rs/jni-sys ">jni-sys-macros 0.4.1</a></li>
|
||||
<li><a href=" https://github.com/jni-rs/jni-rs ">jni 0.22.4</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/libc ">libc 0.2.186</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/libc ">libc 0.2.189</a></li>
|
||||
<li><a href=" https://github.com/JohnTitor/mach2 ">mach2 0.5.0</a></li>
|
||||
<li><a href=" https://github.com/JohnTitor/mach2 ">mach2 0.6.0</a></li>
|
||||
<li><a href=" https://github.com/rust-windowing/android-ndk-rs ">ndk-context 0.1.1</a></li>
|
||||
@@ -5342,15 +5344,14 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/serde-rs/serde ">serde_core 1.0.229</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/serde ">serde_derive 1.0.229</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/serde ">serde_derive_internals 0.29.1</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/json ">serde_json 1.0.150</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/json ">serde_json 1.0.151</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/path-to-error ">serde_path_to_error 0.1.20</a></li>
|
||||
<li><a href=" https://github.com/nox/serde_urlencoded ">serde_urlencoded 0.7.1</a></li>
|
||||
<li><a href=" https://github.com/comex/rust-shlex ">shlex 2.0.1</a></li>
|
||||
<li><a href=" https://github.com/rusticstuff/simdutf8 ">simdutf8 0.1.5</a></li>
|
||||
<li><a href=" https://github.com/jedisct1/rust-siphash ">siphasher 1.0.3</a></li>
|
||||
<li><a href=" https://github.com/4t145/sse-stream/ ">sse-stream 0.2.4</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/syn ">syn 2.0.119</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/syn ">syn 3.0.0</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/syn ">syn 3.0.3</a></li>
|
||||
<li><a href=" https://github.com/Actyx/sync_wrapper ">sync_wrapper 1.0.2</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/thiserror ">thiserror-impl 1.0.69</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/thiserror ">thiserror-impl 2.0.19</a></li>
|
||||
@@ -6197,9 +6198,10 @@ insights.
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://crates.io/crates/own_assist_cli ">own_assist_cli 0.3.0</a></li>
|
||||
<li><a href=" https://crates.io/crates/own_assist_common ">own_assist_common 0.3.0</a></li>
|
||||
<li><a href=" https://crates.io/crates/mcp_server_collection ">mcp_server_collection 0.2.2</a></li>
|
||||
<li><a href=" https://crates.io/crates/own_mcp ">own_mcp 0.1.0</a></li>
|
||||
<li><a href=" https://crates.io/crates/own_assist_common ">own_assist_common 0.3.0</a></li>
|
||||
<li><a href=" https://crates.io/crates/own_assist_common ">own_assist_common 0.4.1</a></li>
|
||||
<li><a href=" https://crates.io/crates/own_mcp ">own_mcp 0.1.1</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
@@ -6613,7 +6615,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/hyperium/hyper ">hyper 1.10.1</a></li>
|
||||
<li><a href=" https://github.com/hyperium/hyper ">hyper 1.11.0</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">Copyright (c) 2014-2026 Sean McArthur
|
||||
|
||||
@@ -6640,7 +6642,7 @@ THE SOFTWARE.
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/badboy/iso8601 ">iso8601 0.6.3</a></li>
|
||||
<li><a href=" https://github.com/badboy/iso8601 ">iso8601 0.6.5</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">Copyright (c) 2015 Jan-Erik Rediger, Hendrik Sollich
|
||||
|
||||
@@ -7395,8 +7397,8 @@ SOFTWARE.
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/pepperoni21/ollama-rs ">ollama-rs-macros 0.3.5</a></li>
|
||||
<li><a href=" https://github.com/pepperoni21/ollama-rs ">ollama-rs 0.3.5</a></li>
|
||||
<li><a href=" https://github.com/pepperoni21/ollama-rs ">ollama-rs-macros 0.3.6</a></li>
|
||||
<li><a href=" https://github.com/pepperoni21/ollama-rs ">ollama-rs 0.3.6</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">MIT License
|
||||
|
||||
@@ -7486,9 +7488,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-stream 0.1.18</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-util 0.7.18</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio 1.53.0</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-stream 0.1.19</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-util 0.7.19</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio 1.53.1</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">MIT License
|
||||
|
||||
@@ -7605,7 +7607,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/BurntSushi/aho-corasick ">aho-corasick 1.1.4</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/jiff ">jiff-core 0.1.0</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/jiff ">jiff 0.2.33</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/jiff ">jiff 0.2.35</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/memchr ">memchr 2.8.3</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/walkdir ">walkdir 2.5.0</a></li>
|
||||
</ul>
|
||||
|
||||
+3
-52
@@ -1,5 +1,4 @@
|
||||
use ollama_rs::Ollama;
|
||||
use ollama_rs::headers::{HeaderMap, HeaderValue};
|
||||
use own_assist_common::config::{AudioClientConfig, MCPClientConfig, OllamaConfig};
|
||||
use own_assist_common::config_from_file;
|
||||
use own_assist_common::config_loader::ConfigLoadingError;
|
||||
use own_mcp::audio::{AudioClient, AudioClientTrait};
|
||||
@@ -9,7 +8,6 @@ use own_mcp::{AgentChat, mcp};
|
||||
use rmcp::model::Implementation;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Config {
|
||||
@@ -19,7 +17,7 @@ pub struct Config {
|
||||
ollama: OllamaConfig,
|
||||
audio: Option<AudioConfig>,
|
||||
#[serde(rename = "mcp-servers")]
|
||||
mcp_servers: Vec<MCPServerConfig>,
|
||||
mcp_servers: Vec<MCPClientConfig>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@@ -31,23 +29,6 @@ impl Config {
|
||||
&self.ollama
|
||||
}
|
||||
|
||||
pub fn ollama_instance(&self) -> Ollama {
|
||||
let mut ollama_headers = HeaderMap::new();
|
||||
|
||||
if let Some(authorization_header) = &self.ollama.authorization {
|
||||
ollama_headers.append(
|
||||
"Authorization",
|
||||
HeaderValue::from_str(authorization_header).unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
let ollama_default_url = Url::parse("http://127.0.0.1:11434").unwrap();
|
||||
let mut ollama = Ollama::from_url(self.ollama.url.clone().unwrap_or(ollama_default_url));
|
||||
ollama.set_headers(Some(ollama_headers));
|
||||
|
||||
ollama
|
||||
}
|
||||
|
||||
pub fn audio_client(&self) -> Option<AudioClient> {
|
||||
if let Some(audio_config) = &self.audio {
|
||||
let audio_server = &audio_config.server;
|
||||
@@ -115,37 +96,7 @@ pub enum HumanInterface {
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct AudioConfig {
|
||||
server: AudioServerConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct AudioServerConfig {
|
||||
url: Url,
|
||||
authorization: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct OllamaConfig {
|
||||
pub url: Option<Url>,
|
||||
pub model: OllamaModelConfig,
|
||||
pub authorization: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct OllamaModelConfig {
|
||||
#[serde(rename = "from-model")]
|
||||
pub from_model: String,
|
||||
pub name: String,
|
||||
pub system_prompt: Option<String>,
|
||||
pub context_size: Option<u64>,
|
||||
pub temperature: Option<f32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct MCPServerConfig {
|
||||
pub name: Option<String>,
|
||||
pub url: Url,
|
||||
pub authorization: Option<String>, // should probably implement oauth some time // actually, fuck oauth
|
||||
server: AudioClientConfig,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
||||
+5
-7
@@ -1,12 +1,10 @@
|
||||
mod config;
|
||||
mod human_interface;
|
||||
mod i18n;
|
||||
mod model;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::human_interface::HumanInterface;
|
||||
use crate::i18n::translate;
|
||||
use crate::model::create_model_from_config;
|
||||
use base64::Engine;
|
||||
use clap::Parser;
|
||||
use cpal::traits::HostTrait;
|
||||
@@ -100,16 +98,16 @@ async fn main() {
|
||||
.inspect_err(exit_msg!("error loading assist.toml"))
|
||||
.unwrap();
|
||||
|
||||
let ollama = config.ollama_instance();
|
||||
let model_name = &config.ollama_config().model.name;
|
||||
let ollama_config = config.ollama_config();
|
||||
let ollama = ollama_config.ollama();
|
||||
let model_name = &ollama_config.model_config.name;
|
||||
|
||||
create_model_from_config(&ollama, &config.ollama_config().model, &config.interface)
|
||||
.await
|
||||
.inspect_err(exit_msg!(format!(
|
||||
ollama_config.create_model(Some(tlt!("model_download_needed"))).await.inspect_err(exit_msg!(format!(
|
||||
"failed creating ollama model `{model_name}`"
|
||||
)))
|
||||
.unwrap();
|
||||
|
||||
|
||||
let mcp_clients = config
|
||||
.mcp_clients()
|
||||
.await
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
use crate::config::{HumanInterface, OllamaModelConfig};
|
||||
use crate::tlt;
|
||||
use crate::translate;
|
||||
use ollama_rs::Ollama;
|
||||
use ollama_rs::error::OllamaError;
|
||||
use ollama_rs::models::ModelOptions;
|
||||
use ollama_rs::models::create::{CreateModelRequest, CreateModelStatus};
|
||||
|
||||
pub async fn create_model_from_config(
|
||||
ollama: &Ollama,
|
||||
config: &OllamaModelConfig,
|
||||
interface: &HumanInterface,
|
||||
) -> Result<CreateModelStatus, OllamaError> {
|
||||
let model_options = ModelOptions::default()
|
||||
.num_ctx(config.context_size.unwrap_or(2048)) // 2048 is the ollama default.
|
||||
.temperature(config.temperature.unwrap_or(0.8)); // 0.8 is the ollama default
|
||||
|
||||
let system_prompt = config.system_prompt.clone().unwrap_or(match interface {
|
||||
HumanInterface::Cli => tlt!("system_prompt_cli"),
|
||||
HumanInterface::Audio => tlt!("system_prompt_audio"),
|
||||
});
|
||||
|
||||
// print message to warn user of long waiting times
|
||||
if let Ok(models) = ollama.list_local_models().await
|
||||
&& !models.iter().any(|m| m.name == config.from_model)
|
||||
{
|
||||
let message = tlt!("model_download_needed", config.from_model.clone());
|
||||
log::info!("{}", message);
|
||||
println!("{}", console::style(message).yellow().bold());
|
||||
}
|
||||
|
||||
ollama
|
||||
.create_model(
|
||||
CreateModelRequest::new(config.name.clone())
|
||||
.from_model(config.from_model.clone())
|
||||
.parameters(model_options)
|
||||
.system(system_prompt),
|
||||
)
|
||||
.await
|
||||
}
|
||||
+4
-2
@@ -1,12 +1,14 @@
|
||||
[package]
|
||||
name = "own_assist_common"
|
||||
version = "0.3.0"
|
||||
version = "0.4.1"
|
||||
edition = "2024"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[dependencies]
|
||||
thiserror = "2.0.18"
|
||||
toml = "1.1.2"
|
||||
serde = "1.0.228"
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
log = "0.4.29"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"]}
|
||||
url = { version = "2.5.8", features = ["serde"] }
|
||||
ollama-rs = { version = "0.3.6", features = ["headers"]}
|
||||
+2358
-5
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
use ollama_rs::error::OllamaError;
|
||||
use ollama_rs::models::ModelOptions;
|
||||
use ollama_rs::models::create::{CreateModelRequest, CreateModelStatus};
|
||||
use serde::Deserialize;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct AudioClientConfig {
|
||||
pub url: Url,
|
||||
pub authorization: Option<String>,
|
||||
}
|
||||
|
||||
fn ollama_default_url() -> Url {
|
||||
Url::parse("http://127.0.0.1:11434").unwrap()
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct OllamaConfig {
|
||||
#[serde(default = "ollama_default_url")]
|
||||
pub url: Url,
|
||||
#[serde(rename = "model")]
|
||||
pub model_config: OllamaModelConfig,
|
||||
pub authorization: Option<String>,
|
||||
}
|
||||
|
||||
impl OllamaConfig {
|
||||
pub fn ollama(&self) -> ollama_rs::Ollama {
|
||||
let mut ollama_headers = ollama_rs::headers::HeaderMap::new();
|
||||
|
||||
if let Some(authorization_header) = &self.authorization {
|
||||
ollama_headers.append(
|
||||
"Authorization",
|
||||
ollama_rs::headers::HeaderValue::from_str(authorization_header.as_str()).unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
let mut ollama = ollama_rs::Ollama::from_url(self.url.clone());
|
||||
ollama.set_headers(Some(ollama_headers));
|
||||
|
||||
ollama
|
||||
}
|
||||
|
||||
pub async fn create_model(
|
||||
&self,
|
||||
download_needed_message: Option<String>,
|
||||
) -> Result<CreateModelStatus, OllamaError> {
|
||||
let ollama = self.ollama();
|
||||
let model_config = &self.model_config;
|
||||
|
||||
let model_options = ModelOptions::default()
|
||||
.num_ctx(model_config.context_size.unwrap_or(2048)) // 2048 is the ollama default.
|
||||
.temperature(model_config.temperature.unwrap_or(0.8)); // 0.8 is the ollama default
|
||||
|
||||
// print message to warn user of long waiting times
|
||||
if let Ok(models) = ollama.list_local_models().await
|
||||
&& !models.iter().any(|m| m.name == model_config.from_model)
|
||||
&& let Some(download_needed_message) = download_needed_message
|
||||
{
|
||||
log::info!("{}", download_needed_message);
|
||||
println!("{}", download_needed_message);
|
||||
}
|
||||
|
||||
let mut create_model_request = CreateModelRequest::new(model_config.name.clone())
|
||||
.from_model(model_config.from_model.clone())
|
||||
.parameters(model_options);
|
||||
|
||||
if let Some(system_prompt) = &model_config.system_prompt {
|
||||
create_model_request = create_model_request.system(system_prompt.clone());
|
||||
}
|
||||
|
||||
ollama.create_model(create_model_request).await
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct OllamaModelConfig {
|
||||
#[serde(rename = "from-model")]
|
||||
pub from_model: String,
|
||||
pub name: String,
|
||||
pub system_prompt: Option<String>,
|
||||
pub context_size: Option<u64>,
|
||||
pub temperature: Option<f32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct MCPClientConfig {
|
||||
pub name: Option<String>,
|
||||
pub url: Url,
|
||||
pub authorization: Option<String>, // should probably implement oauth some time // actually, fuck oauth
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
pub mod config;
|
||||
pub mod config_loader;
|
||||
mod exit_error;
|
||||
mod tracing_init;
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<h3 id="Apache-2.0">Apache License 2.0</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/4t145/sse-stream/ ">sse-stream 0.2.5</a></li>
|
||||
<li><a href=" https://github.com/hsivonen/utf8_iter ">utf8_iter 1.0.4</a></li>
|
||||
<li><a href=" https://github.com/RustCrypto/utils ">zeroize 1.9.0</a></li>
|
||||
</ul>
|
||||
@@ -1755,7 +1756,7 @@ limitations under the License.
|
||||
<h3 id="Apache-2.0">Apache License 2.0</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/rustls/pki-types ">rustls-pki-types 1.15.0</a></li>
|
||||
<li><a href=" https://github.com/rustls/pki-types ">rustls-pki-types 1.15.1</a></li>
|
||||
</ul>
|
||||
<pre class="license-text"> Apache License
|
||||
Version 2.0, January 2004
|
||||
@@ -1969,7 +1970,7 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/marshallpierce/rust-base64 ">base64 0.22.1</a></li>
|
||||
<li><a href=" https://github.com/bitflags/bitflags ">bitflags 2.13.1</a></li>
|
||||
<li><a href=" https://github.com/fitzgen/bumpalo ">bumpalo 3.20.3</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cc-rs ">cc 1.3.0</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cc-rs ">cc 1.4.0</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cfg-if ">cfg-if 1.0.4</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cmake-rs ">cmake 0.1.58</a></li>
|
||||
<li><a href=" https://github.com/servo/core-foundation-rs ">core-foundation-sys 0.8.7</a></li>
|
||||
@@ -3055,7 +3056,7 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/dtolnay/dyn-clone ">dyn-clone 1.0.20</a></li>
|
||||
<li><a href=" https://github.com/TedDriggs/ident_case ">ident_case 1.0.1</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/itoa ">itoa 1.0.18</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/libc ">libc 0.2.186</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/libc ">libc 0.2.189</a></li>
|
||||
<li><a href=" https://github.com/as1100k/pastey ">pastey 0.2.3</a></li>
|
||||
<li><a href=" https://github.com/taiki-e/pin-project-lite ">pin-project-lite 0.2.17</a></li>
|
||||
<li><a href=" https://github.com/taiki-e/portable-atomic-util ">portable-atomic-util 0.2.7</a></li>
|
||||
@@ -3075,14 +3076,13 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/serde-rs/serde ">serde_core 1.0.229</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/serde ">serde_derive 1.0.229</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/serde ">serde_derive_internals 0.29.1</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/json ">serde_json 1.0.150</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/json ">serde_json 1.0.151</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/path-to-error ">serde_path_to_error 0.1.20</a></li>
|
||||
<li><a href=" https://github.com/nox/serde_urlencoded ">serde_urlencoded 0.7.1</a></li>
|
||||
<li><a href=" https://github.com/comex/rust-shlex ">shlex 2.0.1</a></li>
|
||||
<li><a href=" https://github.com/jedisct1/rust-siphash ">siphasher 1.0.3</a></li>
|
||||
<li><a href=" https://github.com/4t145/sse-stream/ ">sse-stream 0.2.4</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/syn ">syn 2.0.119</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/syn ">syn 3.0.0</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/syn ">syn 3.0.3</a></li>
|
||||
<li><a href=" https://github.com/Actyx/sync_wrapper ">sync_wrapper 1.0.2</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/thiserror ">thiserror-impl 2.0.19</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/thiserror ">thiserror 2.0.19</a></li>
|
||||
@@ -3889,8 +3889,8 @@ insights.
|
||||
<h3 id="GPL-3.0">GNU General Public License v3.0 only</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://crates.io/crates/own_assist_common ">own_assist_common 0.3.0</a></li>
|
||||
<li><a href=" https://crates.io/crates/mcp_server_collection ">mcp_server_collection 0.2.2</a></li>
|
||||
<li><a href=" https://crates.io/crates/own_assist_common ">own_assist_common 0.3.0</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
@@ -4271,7 +4271,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/hyperium/hyper ">hyper 1.10.1</a></li>
|
||||
<li><a href=" https://github.com/hyperium/hyper ">hyper 1.11.0</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">Copyright (c) 2014-2026 Sean McArthur
|
||||
|
||||
@@ -4298,7 +4298,7 @@ THE SOFTWARE.
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/badboy/iso8601 ">iso8601 0.6.3</a></li>
|
||||
<li><a href=" https://github.com/badboy/iso8601 ">iso8601 0.6.5</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">Copyright (c) 2015 Jan-Erik Rediger, Hendrik Sollich
|
||||
|
||||
@@ -4971,9 +4971,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-stream 0.1.18</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-util 0.7.18</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio 1.53.0</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-stream 0.1.19</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-util 0.7.19</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio 1.53.1</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">MIT License
|
||||
|
||||
@@ -5090,7 +5090,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/BurntSushi/aho-corasick ">aho-corasick 1.1.4</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/jiff ">jiff-core 0.1.0</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/jiff ">jiff 0.2.33</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/jiff ">jiff 0.2.35</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/memchr ">memchr 2.8.3</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">The MIT License (MIT)
|
||||
|
||||
+16
-16
@@ -61,6 +61,7 @@
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/hsivonen/encoding_rs ">encoding_rs 0.8.35</a></li>
|
||||
<li><a href=" https://github.com/ruuda/hound ">hound 3.5.1</a></li>
|
||||
<li><a href=" https://github.com/4t145/sse-stream/ ">sse-stream 0.2.5</a></li>
|
||||
<li><a href=" https://github.com/nvzqz/static-assertions-rs ">static_assertions 1.1.0</a></li>
|
||||
<li><a href=" https://github.com/hsivonen/utf8_iter ">utf8_iter 1.0.4</a></li>
|
||||
<li><a href=" https://github.com/RustCrypto/utils ">zeroize 1.9.0</a></li>
|
||||
@@ -494,7 +495,7 @@
|
||||
<h3 id="Apache-2.0">Apache License 2.0</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/google/zerocopy ">zerocopy 0.8.54</a></li>
|
||||
<li><a href=" https://github.com/google/zerocopy ">zerocopy 0.8.55</a></li>
|
||||
</ul>
|
||||
<pre class="license-text"> Apache License
|
||||
Version 2.0, January 2004
|
||||
@@ -2825,7 +2826,7 @@ limitations under the License.
|
||||
<h3 id="Apache-2.0">Apache License 2.0</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/rustls/pki-types ">rustls-pki-types 1.15.0</a></li>
|
||||
<li><a href=" https://github.com/rustls/pki-types ">rustls-pki-types 1.15.1</a></li>
|
||||
</ul>
|
||||
<pre class="license-text"> Apache License
|
||||
Version 2.0, January 2004
|
||||
@@ -3039,7 +3040,7 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/marshallpierce/rust-base64 ">base64 0.22.1</a></li>
|
||||
<li><a href=" https://github.com/bitflags/bitflags ">bitflags 2.13.1</a></li>
|
||||
<li><a href=" https://github.com/fitzgen/bumpalo ">bumpalo 3.20.3</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cc-rs ">cc 1.3.0</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cc-rs ">cc 1.4.0</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cfg-if ">cfg-if 1.0.4</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cmake-rs ">cmake 0.1.58</a></li>
|
||||
<li><a href=" https://github.com/servo/core-foundation-rs ">core-foundation-sys 0.8.7</a></li>
|
||||
@@ -3049,7 +3050,7 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/yaahc/displaydoc ">displaydoc 0.2.6</a></li>
|
||||
<li><a href=" https://github.com/indexmap-rs/equivalent ">equivalent 1.0.2</a></li>
|
||||
<li><a href=" https://github.com/lambda-fairy/rust-errno ">errno 0.3.14</a></li>
|
||||
<li><a href=" https://github.com/smol-rs/fastrand ">fastrand 2.4.1</a></li>
|
||||
<li><a href=" https://github.com/smol-rs/fastrand ">fastrand 2.5.0</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/cc-rs ">find-msvc-tools 0.1.9</a></li>
|
||||
<li><a href=" https://github.com/servo/rust-fnv ">fnv 1.0.7</a></li>
|
||||
<li><a href=" https://github.com/servo/rust-url ">form_urlencoded 1.2.2</a></li>
|
||||
@@ -4361,7 +4362,7 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/jni-rs/jni-rs ">jni-macros 0.22.4</a></li>
|
||||
<li><a href=" https://github.com/jni-rs/jni-sys ">jni-sys-macros 0.4.1</a></li>
|
||||
<li><a href=" https://github.com/jni-rs/jni-rs ">jni 0.22.4</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/libc ">libc 0.2.186</a></li>
|
||||
<li><a href=" https://github.com/rust-lang/libc ">libc 0.2.189</a></li>
|
||||
<li><a href=" https://github.com/JohnTitor/mach2 ">mach2 0.6.0</a></li>
|
||||
<li><a href=" https://github.com/rust-windowing/android-ndk-rs ">ndk-context 0.1.1</a></li>
|
||||
<li><a href=" https://github.com/rust-mobile/ndk ">ndk-sys 0.6.0+11769913</a></li>
|
||||
@@ -4395,14 +4396,13 @@ limitations under the License.
|
||||
<li><a href=" https://github.com/serde-rs/serde ">serde_core 1.0.229</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/serde ">serde_derive 1.0.229</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/serde ">serde_derive_internals 0.29.1</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/json ">serde_json 1.0.150</a></li>
|
||||
<li><a href=" https://github.com/serde-rs/json ">serde_json 1.0.151</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/path-to-error ">serde_path_to_error 0.1.20</a></li>
|
||||
<li><a href=" https://github.com/nox/serde_urlencoded ">serde_urlencoded 0.7.1</a></li>
|
||||
<li><a href=" https://github.com/comex/rust-shlex ">shlex 2.0.1</a></li>
|
||||
<li><a href=" https://github.com/rusticstuff/simdutf8 ">simdutf8 0.1.5</a></li>
|
||||
<li><a href=" https://github.com/4t145/sse-stream/ ">sse-stream 0.2.4</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/syn ">syn 2.0.119</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/syn ">syn 3.0.0</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/syn ">syn 3.0.3</a></li>
|
||||
<li><a href=" https://github.com/Actyx/sync_wrapper ">sync_wrapper 1.0.2</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/thiserror ">thiserror-impl 1.0.69</a></li>
|
||||
<li><a href=" https://github.com/dtolnay/thiserror ">thiserror-impl 2.0.19</a></li>
|
||||
@@ -4898,7 +4898,7 @@ insights.
|
||||
<h3 id="GPL-3.0">GNU General Public License v3.0 only</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://crates.io/crates/own_mcp ">own_mcp 0.1.0</a></li>
|
||||
<li><a href=" https://crates.io/crates/own_mcp ">own_mcp 0.1.1</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
@@ -5263,7 +5263,7 @@ THE SOFTWARE.
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/hyperium/hyper ">hyper 1.10.1</a></li>
|
||||
<li><a href=" https://github.com/hyperium/hyper ">hyper 1.11.0</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">Copyright (c) 2014-2026 Sean McArthur
|
||||
|
||||
@@ -5807,8 +5807,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRES
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/pepperoni21/ollama-rs ">ollama-rs-macros 0.3.5</a></li>
|
||||
<li><a href=" https://github.com/pepperoni21/ollama-rs ">ollama-rs 0.3.5</a></li>
|
||||
<li><a href=" https://github.com/pepperoni21/ollama-rs ">ollama-rs-macros 0.3.6</a></li>
|
||||
<li><a href=" https://github.com/pepperoni21/ollama-rs ">ollama-rs 0.3.6</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">MIT License
|
||||
|
||||
@@ -5867,9 +5867,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<h3 id="MIT">MIT License</h3>
|
||||
<h4>Used by:</h4>
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-stream 0.1.18</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-util 0.7.18</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio 1.53.0</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-stream 0.1.19</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio-util 0.7.19</a></li>
|
||||
<li><a href=" https://github.com/tokio-rs/tokio ">tokio 1.53.1</a></li>
|
||||
</ul>
|
||||
<pre class="license-text">MIT License
|
||||
|
||||
@@ -5957,7 +5957,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
<ul class="license-used-by">
|
||||
<li><a href=" https://github.com/BurntSushi/aho-corasick ">aho-corasick 1.1.4</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/jiff ">jiff-core 0.1.0</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/jiff ">jiff 0.2.33</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/jiff ">jiff 0.2.35</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/memchr ">memchr 2.8.3</a></li>
|
||||
<li><a href=" https://github.com/BurntSushi/walkdir ">walkdir 2.5.0</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -9,7 +9,6 @@ use rmcp::ServiceError;
|
||||
use rmcp::model::{CallToolRequestParams, CallToolResult};
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Formatter;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Copy, Clone, Default, Deserialize, PartialEq)]
|
||||
@@ -112,20 +111,6 @@ pub struct ToolUsage {
|
||||
pub result: RestrictedToolCallResult,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ToolUsage {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}(", self.call.function.name)?;
|
||||
|
||||
for (name, value) in self.call.function.arguments.as_object().expect("function.arguments is always an object").iter() {
|
||||
write!(f, "{name}={value}, ")?;
|
||||
}
|
||||
|
||||
write!(f, ") = {:?}", self.result)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl AgentChat {
|
||||
pub async fn new(
|
||||
ollama_client: Ollama,
|
||||
|
||||
Reference in New Issue
Block a user