refactor: refactor BaseLlmClientListener.java

This commit is contained in:
Michael Yang 2024-10-30 11:41:18 +08:00
parent 50d6d7bea8
commit 074d1f03ec

View File

@ -79,9 +79,8 @@ public class BaseLlmClientListener implements LlmClientListener {
return;
}
try {
JSONObject jsonObject = JSON.parseObject(response);
if (isFunctionCalling) {
FunctionMessage functionMessage = functionMessageParser.parse(jsonObject);
List<Function> functions = ((FunctionPrompt) prompt).getFunctions();
@ -96,6 +95,9 @@ public class BaseLlmClientListener implements LlmClientListener {
//noinspection unchecked
streamResponseListener.onMessage(context, aiMessageResponse);
}
} catch (Exception err) {
streamResponseListener.onFailure(context, err);
}
}
@Override