Commit 9b24765
committed
fix: Make sure that
- Add an `AtomicBoolean` to DefaultCallResponseSpec and DefaultStreamResponseSpec to track whether the instance has been used
- Check if the instance has already been used before calling `advisorChain.nextCall`, and throw an `IllegalStateException` if it has
- Add unit tests to confirm that case
Signed-off-by: YunKui Lu <[email protected]>XXXResponseSpec instances can only be used once1 parent daf1274 commit 9b24765
File tree
2 files changed
+47
-0
lines changed- spring-ai-client-chat/src
- main/java/org/springframework/ai/chat/client
- test/java/org/springframework/ai/chat/client
2 files changed
+47
-0
lines changedLines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
348 | 349 | | |
349 | 350 | | |
350 | 351 | | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
351 | 357 | | |
352 | 358 | | |
353 | 359 | | |
| |||
450 | 456 | | |
451 | 457 | | |
452 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
453 | 463 | | |
454 | 464 | | |
455 | 465 | | |
| |||
494 | 504 | | |
495 | 505 | | |
496 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
497 | 512 | | |
498 | 513 | | |
499 | 514 | | |
| |||
508 | 523 | | |
509 | 524 | | |
510 | 525 | | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
511 | 531 | | |
512 | 532 | | |
513 | 533 | | |
| |||
spring-ai-client-chat/src/test/java/org/springframework/ai/chat/client/DefaultChatClientTests.java
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
686 | 687 | | |
687 | 688 | | |
688 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
689 | 703 | | |
690 | 704 | | |
691 | 705 | | |
| |||
1199 | 1213 | | |
1200 | 1214 | | |
1201 | 1215 | | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1202 | 1229 | | |
1203 | 1230 | | |
1204 | 1231 | | |
| |||
0 commit comments