refactor: 统一项目名称从OpenFang到ZCLAW
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
重构所有代码和文档中的项目名称,将OpenFang统一更新为ZCLAW。包括: - 配置文件中的项目名称 - 代码注释和文档引用 - 环境变量和路径 - 类型定义和接口名称 - 测试用例和模拟数据 同时优化部分代码结构,移除未使用的模块,并更新相关依赖项。
This commit is contained in:
32
desktop/src-tauri/src/embedding_adapter.rs
Normal file
32
desktop/src-tauri/src/embedding_adapter.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
//! Embedding Adapter - Bridges Tauri LLM EmbeddingClient to Growth System trait
|
||||
//!
|
||||
//! Implements zclaw_growth::retrieval::semantic::EmbeddingClient
|
||||
//! by wrapping the concrete llm::EmbeddingClient.
|
||||
|
||||
use std::sync::Arc;
|
||||
use zclaw_growth::retrieval::semantic::EmbeddingClient;
|
||||
|
||||
/// Adapter wrapping Tauri's llm::EmbeddingClient to implement the growth trait
|
||||
pub struct TauriEmbeddingAdapter {
|
||||
inner: Arc<crate::llm::EmbeddingClient>,
|
||||
}
|
||||
|
||||
impl TauriEmbeddingAdapter {
|
||||
pub fn new(client: crate::llm::EmbeddingClient) -> Self {
|
||||
Self {
|
||||
inner: Arc::new(client),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl EmbeddingClient for TauriEmbeddingAdapter {
|
||||
async fn embed(&self, text: &str) -> Result<Vec<f32>, String> {
|
||||
let response = self.inner.embed(text).await?;
|
||||
Ok(response.embedding)
|
||||
}
|
||||
|
||||
fn is_available(&self) -> bool {
|
||||
self.inner.is_configured()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user