chore: Bump version to 1.6.12 and refactor JsonAgentResponseHandler to improve response handling
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
<artifactId>lm-lib</artifactId>
|
<artifactId>lm-lib</artifactId>
|
||||||
<groupId>de.extio</groupId>
|
<groupId>de.extio</groupId>
|
||||||
<name>lm-lib</name>
|
<name>lm-lib</name>
|
||||||
<version>1.6.11</version>
|
<version>1.6.12</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ public class JsonAgentResponseHandler implements AgentResponseHandler {
|
|||||||
public boolean handle(final Completion completion, final AgentContext context) {
|
public boolean handle(final Completion completion, final AgentContext context) {
|
||||||
final int firstCurly = completion.response().indexOf("{");
|
final int firstCurly = completion.response().indexOf("{");
|
||||||
final int lastCurly = completion.response().lastIndexOf("}");
|
final int lastCurly = completion.response().lastIndexOf("}");
|
||||||
final var response = completion.response().substring(firstCurly, lastCurly + 1);
|
|
||||||
JsonNode jsonNode;
|
JsonNode jsonNode;
|
||||||
try {
|
try {
|
||||||
|
final var response = completion.response().substring(firstCurly, lastCurly + 1);
|
||||||
jsonNode = this.objectMapper.readTree(response);
|
jsonNode = this.objectMapper.readTree(response);
|
||||||
}
|
}
|
||||||
catch (final Exception e) {
|
catch (final Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user