Skip to content

Commit

Permalink
feat: 新增audio转换器,用于后续对接其它平台
Browse files Browse the repository at this point in the history
  • Loading branch information
LnYo-Cly committed Oct 12, 2024
1 parent 575a336 commit b779f98
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.github.lnyocly.ai4j.convert.audio;

/**
* @Author cly
* @Description 处理请求参数。 由统一的OpenAi音频格式--->其它模型格式
* @Date 2024/10/12 13:36
*/
public interface AudioParameterConvert<T> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.github.lnyocly.ai4j.convert.audio;

/**
* @Author cly
* @Description 返回结果统一处理。 其它模型音频返回格式--->统一的OpenAi返回格式
* @Date 2024/10/12 13:35
*/
public interface AudioResultConvert<T> {
}
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b779f98

Please sign in to comment.