31 lines
1.1 KiB
Rust
31 lines
1.1 KiB
Rust
impl From<crate::core::llm::ChatRole> for crate::databases::postgres::chat::types::MessageRole {
|
|
fn from(m: crate::core::llm::ChatRole) -> Self {
|
|
match m {
|
|
crate::core::llm::ChatRole::System => {
|
|
crate::databases::postgres::chat::types::MessageRole::System
|
|
}
|
|
crate::core::llm::ChatRole::Assistant => {
|
|
crate::databases::postgres::chat::types::MessageRole::Assistant
|
|
}
|
|
crate::core::llm::ChatRole::User => {
|
|
crate::databases::postgres::chat::types::MessageRole::User
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<crate::core::auth::api_key::KeyRole>
|
|
for crate::databases::postgres::api_key::types::Role
|
|
{
|
|
fn from(role: crate::core::auth::api_key::KeyRole) -> Self {
|
|
match role {
|
|
crate::core::auth::api_key::KeyRole::User => {
|
|
crate::databases::postgres::api_key::types::Role::User
|
|
}
|
|
crate::core::auth::api_key::KeyRole::Admin => {
|
|
crate::databases::postgres::api_key::types::Role::Admin
|
|
}
|
|
}
|
|
}
|
|
}
|