mod support;
use genai::ModelIden;
use genai::adapter::AdapterKind;
use genai::chat::*;
use support::yakbak::replay_client;
use support::{TestResult, extract_stream_end};
#[tokio::test]
async fn test_yakbak_opencode_go_minimax_chat() -> TestResult<()> {
let (client, _server) = replay_client("opencode_go", "minimax_chat").await?;
let chat_req = ChatRequest::new(vec![ChatMessage::user("Say hello in one word")]);
let chat_res = client
.exec_chat(ModelIden::new(AdapterKind::OpenCodeGo, "minimax-m2.5"), chat_req, None)
.await?;
let text = chat_res.first_text().ok_or("Should have text content")?;
assert!(!text.is_empty(), "Response text should not be empty: {text:?}");
Ok(())
}
#[tokio::test]
async fn test_yakbak_opencode_go_minimax_stream() -> TestResult<()> {
let (client, _server) = replay_client("opencode_go", "minimax_stream").await?;
let chat_req = ChatRequest::new(vec![ChatMessage::user("Say hello in one word")]);
let options = ChatOptions::default().with_capture_content(true);
let stream_res = client
.exec_chat_stream(
ModelIden::new(AdapterKind::OpenCodeGo, "minimax-m2.5"),
chat_req,
Some(&options),
)
.await?;
let extract = extract_stream_end(stream_res.stream).await?;
assert!(
extract.content.is_some() && !extract.content.as_deref().unwrap_or("").is_empty(),
"Should have received at least one content chunk"
);
Ok(())
}
#[tokio::test]
async fn test_yakbak_opencode_go_openai_chat() -> TestResult<()> {
let (client, _server) = replay_client("opencode_go", "openai_chat").await?;
let chat_req = ChatRequest::new(vec![ChatMessage::user("Say hello in one word")]);
let chat_res = client
.exec_chat(ModelIden::new(AdapterKind::OpenCodeGo, "glm-5"), chat_req, None)
.await?;
let text = chat_res.first_text().ok_or("Should have text content")?;
assert!(!text.is_empty(), "Response text should not be empty: {text:?}");
Ok(())
}
#[tokio::test]
async fn test_yakbak_opencode_go_openai_stream() -> TestResult<()> {
let (client, _server) = replay_client("opencode_go", "openai_stream").await?;
let chat_req = ChatRequest::new(vec![ChatMessage::user("Say hello in one word")]);
let options = ChatOptions::default().with_capture_content(true);
let stream_res = client
.exec_chat_stream(
ModelIden::new(AdapterKind::OpenCodeGo, "glm-5"),
chat_req,
Some(&options),
)
.await?;
let extract = extract_stream_end(stream_res.stream).await?;
assert!(
extract.content.is_some() && !extract.content.as_deref().unwrap_or("").is_empty(),
"Should have received at least one content chunk"
);
Ok(())
}