|
@@ -51,12 +51,12 @@ public class GeminiGenerateContentAction implements Action {
|
|
|
@Override
|
|
|
public String execute(ActionParam param) {
|
|
|
Integer type = param.getType();
|
|
|
-// ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
-// int index = random.nextInt(apiKeyList.size());
|
|
|
-// String apiKey = apiKeyList.get(index);
|
|
|
- int size = apiKeyList.size();
|
|
|
- int index = getIndex(size);
|
|
|
- String apiKey = apiKeyList.get(index);
|
|
|
+ String apiKey = "";
|
|
|
+ if (Objects.nonNull(apiKeyList) && !apiKeyList.isEmpty()) {
|
|
|
+ int size = apiKeyList.size();
|
|
|
+ int index = getIndex(size);
|
|
|
+ apiKey = apiKeyList.get(index);
|
|
|
+ }
|
|
|
GeminiParam geminiParam = new GeminiParam();
|
|
|
geminiParam.setType(type);
|
|
|
geminiParam.setPrompt(param.getPrompt());
|