【代码优化】AI:完善 OpenAIChatModelTests、OpenAiImageModelTests 单测,方便大家快速体验

This commit is contained in:
YunaiV
2024-07-06 14:11:21 +08:00
parent e0f08a0f02
commit 1feff2b12b
6 changed files with 108 additions and 73 deletions

View File

@ -23,7 +23,7 @@ public interface AiModelFactory {
* @param url API URL
* @return ChatModel 对象
*/
ChatModel getOrCreateChatClient(AiPlatformEnum platform, String apiKey, String url);
ChatModel getOrCreateChatModel(AiPlatformEnum platform, String apiKey, String url);
/**
* 基于默认配置,获得 ChatModel 对象

View File

@ -50,7 +50,7 @@ import java.util.List;
public class AiModelFactoryImpl implements AiModelFactory {
@Override
public ChatModel getOrCreateChatClient(AiPlatformEnum platform, String apiKey, String url) {
public ChatModel getOrCreateChatModel(AiPlatformEnum platform, String apiKey, String url) {
String cacheKey = buildClientCacheKey(ChatModel.class, platform, apiKey, url);
return Singleton.get(cacheKey, (Func0<ChatModel>) () -> {
//noinspection EnhancedSwitchMigration