Nathan.fooo bdac73e934
chore: refactor local ai (#7880)
* chore: refactor local ai

* chore: ios build
2025-05-05 20:27:29 +08:00

36 lines
965 B
Rust

use crate::setup_log;
use flowy_ai::local_ai::chat::llm::LLMOllama;
use flowy_ai::local_ai::database::translate::DatabaseTranslateChain;
use flowy_ai_pub::cloud::ai_dto::TranslateRowData;
use flowy_database_pub::cloud::TranslateItem;
#[tokio::test]
async fn local_ollama_test_database_translate() {
setup_log();
let ollama = LLMOllama::default().with_model("llama3.1");
let chain = DatabaseTranslateChain::new(ollama);
let data = TranslateRowData {
cells: vec![
TranslateItem {
title: "name".to_string(),
content: "Jask".to_string(),
},
TranslateItem {
title: "age".to_string(),
content: "25".to_string(),
},
TranslateItem {
title: "city".to_string(),
content: "New York".to_string(),
},
],
language: "french".to_string(),
include_header: false,
};
let resp = chain.translate(data).await.unwrap();
dbg!(&resp);
assert!(!resp.items.is_empty());
}