diff --git a/docs/content/guides/assistants.md b/docs/content/guides/assistants.md index a9c76978a..0adcb3039 100644 --- a/docs/content/guides/assistants.md +++ b/docs/content/guides/assistants.md @@ -121,19 +121,19 @@ app.blockAction("assistant-generate-numbers", (req, ctx) -> { assistant.botMessage((req, ctx) -> { if (req.getEvent().getMetadata() != null && req.getEvent().getMetadata().getEventType().equals("assistant-generate-numbers")) { - try { - ctx.setStatus("is typing..."); - Double num = (Double) req.getEvent().getMetadata().getEventPayload().get("num"); - Set numbers = new HashSet<>(); - SecureRandom random = new SecureRandom(); - while (numbers.size() < num) { - numbers.add(String.valueOf(random.nextInt(100))); + try { + ctx.setStatus("is typing..."); + Double num = (Double) req.getEvent().getMetadata().getEventPayload().get("num"); + Set numbers = new HashSet<>(); + SecureRandom random = new SecureRandom(); + while (numbers.size() < num) { + numbers.add(String.valueOf(random.nextInt(100))); + } + Thread.sleep(1000L); + ctx.say(r -> r.text("Her you are: " + String.join(", ", numbers))); + } catch (Exception e) { + ctx.logger.error("Failed to handle assistant bot message event: {e}", e); } - Thread.sleep(1000L); - ctx.say(r -> r.text("Her you are: " + String.join(", ", numbers))); - } catch (Exception e) { - ctx.logger.error("Failed to handle assistant bot message event: {e}", e); - } } }); diff --git a/docs/i18n/ja-jp/docusaurus-plugin-content-docs/current/guides/assistants.md b/docs/i18n/ja-jp/docusaurus-plugin-content-docs/current/guides/assistants.md index d1e4ba468..00a9670e6 100644 --- a/docs/i18n/ja-jp/docusaurus-plugin-content-docs/current/guides/assistants.md +++ b/docs/i18n/ja-jp/docusaurus-plugin-content-docs/current/guides/assistants.md @@ -122,19 +122,19 @@ app.blockAction("assistant-generate-numbers", (req, ctx) -> { assistant.botMessage((req, ctx) -> { if (req.getEvent().getMetadata() != null && req.getEvent().getMetadata().getEventType().equals("assistant-generate-numbers")) { - try { - ctx.setStatus("is typing..."); - Double num = (Double) req.getEvent().getMetadata().getEventPayload().get("num"); - Set numbers = new HashSet<>(); - SecureRandom random = new SecureRandom(); - while (numbers.size() < num) { - numbers.add(String.valueOf(random.nextInt(100))); + try { + ctx.setStatus("is typing..."); + Double num = (Double) req.getEvent().getMetadata().getEventPayload().get("num"); + Set numbers = new HashSet<>(); + SecureRandom random = new SecureRandom(); + while (numbers.size() < num) { + numbers.add(String.valueOf(random.nextInt(100))); + } + Thread.sleep(1000L); + ctx.say(r -> r.text("Her you are: " + String.join(", ", numbers))); + } catch (Exception e) { + ctx.logger.error("Failed to handle assistant bot message event: {e}", e); } - Thread.sleep(1000L); - ctx.say(r -> r.text("Her you are: " + String.join(", ", numbers))); - } catch (Exception e) { - ctx.logger.error("Failed to handle assistant bot message event: {e}", e); - } } });