Address review feedback

- Replace Thread.sleep with sendAndWait in PRVisualization
- Fix top-level statements in multiple-sessions.md (wrap in class)
- Fix .getMessage() → .getData().content() in MultipleSessions.java
- Guard against null readLine() in AccessibilityReport.java
- Add null-safe getCause() + InterruptedException handling in ErrorHandling.java
- Fix paths: jbang commands now include recipe/ prefix
- Fix root README path: cd java/recipe (not java/cookbook/recipe)
- Fix recipe/README.md ralph-loop CLI example
This commit is contained in:
Bruno Borges
2026-04-06 14:12:08 -04:00
parent 57b2799408
commit 0f06f346be
4 changed files with 32 additions and 38 deletions

View File

@@ -23,7 +23,7 @@ import com.github.copilot.sdk.json.*;
public class MultipleSessions {
public static void main(String[] args) throws Exception {
var client = new CopilotClient();
try (var client = new CopilotClient()) {
client.start().get();
// Create multiple independent sessions
@@ -51,7 +51,7 @@ public class MultipleSessions {
session1.destroy().get();
session2.destroy().get();
session3.destroy().get();
client.stop().get();
}
}
}
```

View File

@@ -118,10 +118,7 @@ public class PRVisualization {
Finally, summarize the PR health - average age, oldest PR, and how many might be considered stale.
""", owner, repoName);
session.send(new MessageOptions().setPrompt(prompt));
// Wait a bit for initial processing
Thread.sleep(10000);
session.sendAndWait(new MessageOptions().setPrompt(prompt)).get();
// Interactive loop
System.out.println("\n💡 Ask follow-up questions or type \"exit\" to quit.\n");
@@ -145,8 +142,7 @@ public class PRVisualization {
break;
}
session.send(new MessageOptions().setPrompt(input));
Thread.sleep(2000); // Give time for response
session.sendAndWait(new MessageOptions().setPrompt(input)).get();
}
}

View File

@@ -93,10 +93,7 @@ public class PRVisualization {
Finally, summarize the PR health - average age, oldest PR, and how many might be considered stale.
""", owner, repoName);
session.send(new MessageOptions().setPrompt(prompt));
// Wait a bit for initial processing
Thread.sleep(10000);
session.sendAndWait(new MessageOptions().setPrompt(prompt)).get();
// Interactive loop
System.out.println("\n💡 Ask follow-up questions or type \"exit\" to quit.\n");
@@ -120,8 +117,7 @@ public class PRVisualization {
break;
}
session.send(new MessageOptions().setPrompt(input));
Thread.sleep(2000); // Give time for response
session.sendAndWait(new MessageOptions().setPrompt(input)).get();
}
}

View File

@@ -54,8 +54,10 @@ jbang PRVisualization.java github/copilot-sdk
jbang ManagingLocalFiles.java /path/to/your/folder
```
**Ralph Loop with a prompt file:**
**Ralph Loop with a custom prompt file:**
```bash
jbang RalphLoop.java PROMPT_build.md 20
```
## Why JBang?