1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use serde::Deserialize;
use std::fmt::{self, Display, Formatter};

#[derive(Debug, Deserialize)]
pub struct LLMConfig {
    pub host: String,
    pub api_key: String,
    pub llm_model: String,
}

#[derive(Debug, Deserialize)]
pub struct IMConfig {
    pub host: String,
    pub api_key: String,
    pub image_model: String,
}

#[derive(Debug, Deserialize)]
pub struct AIConfig {
    pub llm: LLMConfig,
    pub im: IMConfig,
}

impl Display for LLMConfig {
    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
        write!(
            f,
            "Host: {}\nAPI Key: {}\nModel: {}",
            self.host, self.api_key, self.llm_model
        )
    }
}

impl Display for IMConfig {
    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
        write!(
            f,
            "Host: {}\nAPI Key: {}\nModel: {}",
            self.host, self.api_key, self.image_model
        )
    }
}

impl Display for AIConfig {
    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
        write!(f, "LLM Config:\n{}\nIM Config:\n{}", self.llm, self.im)
    }
}