|
|
|
|
@ -7,10 +7,12 @@ import okhttp3.mockwebserver.MockWebServer;
|
|
|
|
|
import okhttp3.mockwebserver.RecordedRequest;
|
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
|
|
|
|
|
|
@ -83,6 +85,16 @@ class DashScopeQwenChatClientTest {
|
|
|
|
|
assertEquals(HttpStatus.BAD_GATEWAY, exception.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void canBeCreatedBySpringWithQwenProperties() {
|
|
|
|
|
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) {
|
|
|
|
|
context.register(QwenProperties.class, DashScopeQwenChatClient.class);
|
|
|
|
|
context.refresh();
|
|
|
|
|
|
|
|
|
|
assertNotNull(context.getBean(QwenChatClient.class));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DashScopeQwenChatClient client(String apiKey) {
|
|
|
|
|
QwenProperties properties = new QwenProperties();
|
|
|
|
|
properties.setBaseUrl(server.url("/compatible-mode/v1").toString().replaceAll("/$", ""));
|
|
|
|
|
|