diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/audio/AudioParameterConvert.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/audio/AudioParameterConvert.java new file mode 100644 index 0000000..039a9ea --- /dev/null +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/audio/AudioParameterConvert.java @@ -0,0 +1,9 @@ +package io.github.lnyocly.ai4j.convert.audio; + +/** + * @Author cly + * @Description 处理请求参数。 由统一的OpenAi音频格式--->其它模型格式 + * @Date 2024/10/12 13:36 + */ +public interface AudioParameterConvert { +} diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/audio/AudioResultConvert.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/audio/AudioResultConvert.java new file mode 100644 index 0000000..9cd99e4 --- /dev/null +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/audio/AudioResultConvert.java @@ -0,0 +1,9 @@ +package io.github.lnyocly.ai4j.convert.audio; + +/** + * @Author cly + * @Description 返回结果统一处理。 其它模型音频返回格式--->统一的OpenAi返回格式 + * @Date 2024/10/12 13:35 + */ +public interface AudioResultConvert { +} diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/ParameterConvert.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/chat/ParameterConvert.java similarity index 87% rename from ai4j/src/main/java/io/github/lnyocly/ai4j/convert/ParameterConvert.java rename to ai4j/src/main/java/io/github/lnyocly/ai4j/convert/chat/ParameterConvert.java index d809eb5..0f4cf46 100644 --- a/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/ParameterConvert.java +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/chat/ParameterConvert.java @@ -1,4 +1,4 @@ -package io.github.lnyocly.ai4j.convert; +package io.github.lnyocly.ai4j.convert.chat; import io.github.lnyocly.ai4j.platform.openai.chat.entity.ChatCompletion; diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/ResultConvert.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/chat/ResultConvert.java similarity index 86% rename from ai4j/src/main/java/io/github/lnyocly/ai4j/convert/ResultConvert.java rename to ai4j/src/main/java/io/github/lnyocly/ai4j/convert/chat/ResultConvert.java index bb1e01c..9ebb57e 100644 --- a/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/ResultConvert.java +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/convert/chat/ResultConvert.java @@ -1,8 +1,7 @@ -package io.github.lnyocly.ai4j.convert; +package io.github.lnyocly.ai4j.convert.chat; import io.github.lnyocly.ai4j.listener.SseListener; import io.github.lnyocly.ai4j.platform.openai.chat.entity.ChatCompletionResponse; -import okhttp3.sse.EventSource; import okhttp3.sse.EventSourceListener; /** diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/deepseek/chat/DeepSeekChatService.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/deepseek/chat/DeepSeekChatService.java index d8a0bbe..842c6d8 100644 --- a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/deepseek/chat/DeepSeekChatService.java +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/deepseek/chat/DeepSeekChatService.java @@ -3,8 +3,8 @@ import com.alibaba.fastjson2.JSON; import io.github.lnyocly.ai4j.config.DeepSeekConfig; import io.github.lnyocly.ai4j.constant.Constants; -import io.github.lnyocly.ai4j.convert.ParameterConvert; -import io.github.lnyocly.ai4j.convert.ResultConvert; +import io.github.lnyocly.ai4j.convert.chat.ParameterConvert; +import io.github.lnyocly.ai4j.convert.chat.ResultConvert; import io.github.lnyocly.ai4j.listener.SseListener; import io.github.lnyocly.ai4j.platform.deepseek.chat.entity.DeepSeekChatCompletion; import io.github.lnyocly.ai4j.platform.deepseek.chat.entity.DeepSeekChatCompletionResponse; diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/hunyuan/chat/HunyuanChatService.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/hunyuan/chat/HunyuanChatService.java index 4071a2b..9749597 100644 --- a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/hunyuan/chat/HunyuanChatService.java +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/hunyuan/chat/HunyuanChatService.java @@ -5,8 +5,8 @@ import com.alibaba.fastjson2.JSONObject; import io.github.lnyocly.ai4j.config.HunyuanConfig; import io.github.lnyocly.ai4j.constant.Constants; -import io.github.lnyocly.ai4j.convert.ParameterConvert; -import io.github.lnyocly.ai4j.convert.ResultConvert; +import io.github.lnyocly.ai4j.convert.chat.ParameterConvert; +import io.github.lnyocly.ai4j.convert.chat.ResultConvert; import io.github.lnyocly.ai4j.listener.SseListener; import io.github.lnyocly.ai4j.platform.hunyuan.HunyuanConstant; import io.github.lnyocly.ai4j.platform.hunyuan.chat.entity.HunyuanChatCompletion; diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/lingyi/chat/LingyiChatService.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/lingyi/chat/LingyiChatService.java index e7226bd..aff1dd8 100644 --- a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/lingyi/chat/LingyiChatService.java +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/lingyi/chat/LingyiChatService.java @@ -1,14 +1,11 @@ package io.github.lnyocly.ai4j.platform.lingyi.chat; import com.alibaba.fastjson2.JSON; -import io.github.lnyocly.ai4j.config.DeepSeekConfig; import io.github.lnyocly.ai4j.config.LingyiConfig; import io.github.lnyocly.ai4j.constant.Constants; -import io.github.lnyocly.ai4j.convert.ParameterConvert; -import io.github.lnyocly.ai4j.convert.ResultConvert; +import io.github.lnyocly.ai4j.convert.chat.ParameterConvert; +import io.github.lnyocly.ai4j.convert.chat.ResultConvert; import io.github.lnyocly.ai4j.listener.SseListener; -import io.github.lnyocly.ai4j.platform.deepseek.chat.entity.DeepSeekChatCompletion; -import io.github.lnyocly.ai4j.platform.deepseek.chat.entity.DeepSeekChatCompletionResponse; import io.github.lnyocly.ai4j.platform.lingyi.chat.entity.LingyiChatCompletion; import io.github.lnyocly.ai4j.platform.lingyi.chat.entity.LingyiChatCompletionResponse; import io.github.lnyocly.ai4j.platform.openai.chat.entity.ChatCompletion; diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/moonshot/chat/MoonshotChatService.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/moonshot/chat/MoonshotChatService.java index 13a7993..84837e5 100644 --- a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/moonshot/chat/MoonshotChatService.java +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/moonshot/chat/MoonshotChatService.java @@ -5,8 +5,8 @@ import com.alibaba.fastjson2.JSONPath; import io.github.lnyocly.ai4j.config.MoonshotConfig; import io.github.lnyocly.ai4j.constant.Constants; -import io.github.lnyocly.ai4j.convert.ParameterConvert; -import io.github.lnyocly.ai4j.convert.ResultConvert; +import io.github.lnyocly.ai4j.convert.chat.ParameterConvert; +import io.github.lnyocly.ai4j.convert.chat.ResultConvert; import io.github.lnyocly.ai4j.listener.SseListener; import io.github.lnyocly.ai4j.platform.moonshot.chat.entity.MoonshotChatCompletion; import io.github.lnyocly.ai4j.platform.moonshot.chat.entity.MoonshotChatCompletionResponse; diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/ollama/chat/OllamaAiChatService.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/ollama/chat/OllamaAiChatService.java index f934d25..741c105 100644 --- a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/ollama/chat/OllamaAiChatService.java +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/ollama/chat/OllamaAiChatService.java @@ -3,14 +3,11 @@ import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; -import com.alibaba.fastjson2.JSONPath; import io.github.lnyocly.ai4j.config.OllamaConfig; import io.github.lnyocly.ai4j.constant.Constants; -import io.github.lnyocly.ai4j.convert.ParameterConvert; -import io.github.lnyocly.ai4j.convert.ResultConvert; +import io.github.lnyocly.ai4j.convert.chat.ParameterConvert; +import io.github.lnyocly.ai4j.convert.chat.ResultConvert; import io.github.lnyocly.ai4j.listener.SseListener; -import io.github.lnyocly.ai4j.platform.deepseek.chat.entity.DeepSeekChatCompletion; -import io.github.lnyocly.ai4j.platform.moonshot.chat.entity.MoonshotChatCompletionResponse; import io.github.lnyocly.ai4j.platform.ollama.chat.entity.OllamaChatCompletion; import io.github.lnyocly.ai4j.platform.ollama.chat.entity.OllamaChatCompletionResponse; import io.github.lnyocly.ai4j.platform.ollama.chat.entity.OllamaMessage; @@ -30,12 +27,10 @@ import okhttp3.*; import okhttp3.sse.EventSource; import okhttp3.sse.EventSourceListener; -import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.io.IOException; import java.time.Instant; import java.util.ArrayList; import java.util.List; diff --git a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/zhipu/chat/ZhipuChatService.java b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/zhipu/chat/ZhipuChatService.java index da8b468..f5dcdfc 100644 --- a/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/zhipu/chat/ZhipuChatService.java +++ b/ai4j/src/main/java/io/github/lnyocly/ai4j/platform/zhipu/chat/ZhipuChatService.java @@ -3,8 +3,8 @@ import com.alibaba.fastjson2.JSON; import io.github.lnyocly.ai4j.config.ZhipuConfig; import io.github.lnyocly.ai4j.constant.Constants; -import io.github.lnyocly.ai4j.convert.ParameterConvert; -import io.github.lnyocly.ai4j.convert.ResultConvert; +import io.github.lnyocly.ai4j.convert.chat.ParameterConvert; +import io.github.lnyocly.ai4j.convert.chat.ResultConvert; import io.github.lnyocly.ai4j.listener.SseListener; import io.github.lnyocly.ai4j.platform.openai.chat.entity.ChatCompletion; import io.github.lnyocly.ai4j.platform.openai.chat.entity.ChatCompletionResponse;