File tree Expand file tree Collapse file tree
src/main/java/io/github/easy4j/kimi/acp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -712,12 +712,14 @@ private String firstText(JsonNode node, String... fields) {
712712 private final class PromptStream {
713713
714714 private final StringBuilder content = new StringBuilder ();
715+ private final String sessionId ;
715716 private final Consumer <String > onDelta ;
716717 private volatile RuntimeException callbackFailure ;
717718 private volatile CompletableFuture <KimiAcpTurnResult > turnFuture ;
718719 private boolean truncationWarned ;
719720
720721 PromptStream (String sessionId , Consumer <String > onDelta ) {
722+ this .sessionId = sessionId ;
721723 this .onDelta = onDelta ;
722724 }
723725
@@ -729,19 +731,10 @@ void cancel() {
729731 CompletableFuture <KimiAcpTurnResult > future = turnFuture ;
730732 if (future != null ) {
731733 future .completeExceptionally (new KimiException (
732- "kimi acp session/prompt cancelled: " + sessionId () ));
734+ "kimi acp session/prompt cancelled: " + sessionId ));
733735 }
734736 }
735737
736- private String sessionId () {
737- for (Map .Entry <String , PromptStream > entry : promptStreams .entrySet ()) {
738- if (entry .getValue () == this ) {
739- return entry .getKey ();
740- }
741- }
742- return "unknown" ;
743- }
744-
745738 void append (String text ) {
746739 int cap = config .getMaxContentChars ();
747740 String applied = text ;
You can’t perform that action at this time.
0 commit comments