#[non_exhaustive]pub struct ParsedProfile {
pub name: String,
pub protocol: Protocol,
pub raw_provider: String,
pub base_url: String,
pub api_key: String,
pub model: String,
pub model_fallback: bool,
}Expand description
解析成功的结果。
带 Serialize 是为了能直接从 Tauri Command 返回给「粘贴导入」表单。
🔴 它含 api_key 明文 —— 序列化后会经 IPC 到达前端。这是粘贴导入这个
功能本身的要求(表单要把密钥填进去),但因此:不要把整个结构体写进日志,
也不要把它存进任何缓存。
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: String配置名;来源没给时为空串,调用方可用 provider 名兜底
protocol: Protocol推断出的协议 —— 决定走 /v1/messages 还是 /v1/chat/completions
raw_provider: String来源软件给的原始 provider 字符串(原样保留,便于 UI 让用户确认)
base_url: String端点地址;空串 = 来源没给,走接收方的默认端点
api_key: String明文密钥;空串 = 来源没给
model: String模型 id
model_fallback: bool🔴 为真表示来源没给 model,当前值是接收方补的默认值。
调用方应当提示用户确认 —— 中转站暴露的模型名往往与官方不同, 猜错要等第一次对话才报错。
Trait Implementations§
Source§impl Clone for ParsedProfile
impl Clone for ParsedProfile
Source§impl Debug for ParsedProfile
impl Debug for ParsedProfile
impl Eq for ParsedProfile
Source§impl PartialEq for ParsedProfile
impl PartialEq for ParsedProfile
Source§impl Serialize for ParsedProfile
impl Serialize for ParsedProfile
impl StructuralPartialEq for ParsedProfile
Auto Trait Implementations§
impl Freeze for ParsedProfile
impl RefUnwindSafe for ParsedProfile
impl Send for ParsedProfile
impl Sync for ParsedProfile
impl Unpin for ParsedProfile
impl UnsafeUnpin for ParsedProfile
impl UnwindSafe for ParsedProfile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more