Skip to content

Commit

Permalink
Merge pull request #107 from siwonKH/main
Browse files Browse the repository at this point in the history
Add status webhook
  • Loading branch information
siwonKH committed Jul 12, 2023
2 parents 91d5352 + 2621f2e commit c5bc585
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class ChatRestController {
@PostConstruct
public void init() {
this.openAiService = new OpenAiService(token);
discordWebhookService.queueStatusLog("Server start up");
}

@PostMapping("/example")
Expand Down Expand Up @@ -274,10 +275,10 @@ public SseEmitter getChatEvents(HttpSession session, HttpServletResponse respons
ChatMessageRole.SYSTEM.value(),
"Below is job_code_table."
));
chatMessages.add(new ChatMessage(
ChatMessageRole.SYSTEM.value(),
CsvReader.getDetailedJobCode(user.getCategory())
));
// chatMessages.add(new ChatMessage(
// ChatMessageRole.SYSTEM.value(),
// CsvReader.getDetailedJobCode(user.getCategory())
// ));

chatMessages.add(accumulatedMessage);
chatMessages.add(callResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ public void queueErrorLog(String userId, String message, Throwable e) {
errorLogQueue.add(embed);
}

public void queueStatusLog(String message) {
DiscordWebhook.EmbedObject embed = new DiscordWebhook.EmbedObject()
.setTitle("김비서 상태")
.setColor(Color.LIGHT_GRAY)
.addField("message", message, false)
.setFooter(sdf.format(new Date()), "");

errorLogQueue.add(embed);
}

public void queueChatLog(String userId, String userName, String message) {
if (message.length() > 300) {
message = message.substring(0, 300);
Expand Down

0 comments on commit c5bc585

Please sign in to comment.