add config to own_assist_common
This commit is contained in:
+1
-48
@@ -19,7 +19,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 +31,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;
|
||||
@@ -118,36 +101,6 @@ 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
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct PermissionConfig {
|
||||
#[serde(rename = "tool-name")]
|
||||
|
||||
Reference in New Issue
Block a user