|
@@ -58,22 +58,22 @@ public class AliBaiLianAIClient {
|
|
|
return apiKey;
|
|
|
}
|
|
|
|
|
|
-// public ModelsList ListModels() throws IOException {
|
|
|
-// OkHttpClient client = new OkHttpClient();
|
|
|
-// okhttp3.Request request = new okhttp3.Request.Builder()
|
|
|
-// .url(getModelsUrl())
|
|
|
-// .addHeader("Authorization", "Bearer " + getApiKey())
|
|
|
-// .build();
|
|
|
-// try {
|
|
|
-// okhttp3.Response response = client.newCall(request).execute();
|
|
|
-// String body = response.body().string();
|
|
|
-// Gson gson = new Gson();
|
|
|
-// return gson.fromJson(body, ModelsList.class);
|
|
|
-// } catch (IOException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// throw e;
|
|
|
-// }
|
|
|
-// }
|
|
|
+ public ModelsList ListModels() throws IOException {
|
|
|
+ OkHttpClient client = new OkHttpClient();
|
|
|
+ okhttp3.Request request = new okhttp3.Request.Builder()
|
|
|
+ .url(getModelsUrl())
|
|
|
+ .addHeader("Authorization", "Bearer " + getApiKey())
|
|
|
+ .build();
|
|
|
+ try {
|
|
|
+ okhttp3.Response response = client.newCall(request).execute();
|
|
|
+ String body = response.body().string();
|
|
|
+ Gson gson = new Gson();
|
|
|
+ return gson.fromJson(body, ModelsList.class);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw e;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
public ChatCompletionResponse ChatCompletion(ChatCompletionRequest request) throws IOException {
|