From 7d0bb646980e8237db1910476aa83b1322163ccc Mon Sep 17 00:00:00 2001 From: nalbam Date: Tue, 11 Jun 2024 10:20:19 +0900 Subject: [PATCH 1/2] fix chat_update bug --- .env.example | 2 +- handler.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 2ae8914..d421729 100644 --- a/.env.example +++ b/.env.example @@ -12,5 +12,5 @@ ALLOWED_CHANNEL_IDS="C000000,C000001" SYSTEM_MESSAGE="너는 AWSKRUG(AWS Korea User Group)에서 친절하게 도움을 주는 구름이(Gurumi)야." -MAX_LEN_SLACK="10000" +MAX_LEN_SLACK="3000" MAX_LEN_BEDROCK="4000" diff --git a/handler.py b/handler.py index cd3817f..c6d0824 100644 --- a/handler.py +++ b/handler.py @@ -126,9 +126,9 @@ def chat_update(say, channel, thread_ts, latest_ts, message="", continue_thread= app.client.chat_update(channel=channel, ts=latest_ts, text=text) if continue_thread: - text = text.replace("**", "*") + " " + BOT_CURSOR + text = message.replace("**", "*") + " " + BOT_CURSOR else: - text = text.replace("**", "*") + text = message.replace("**", "*") # New message result = say(text=text, thread_ts=thread_ts) From 6ec1d6e2566b0039ccea10629e5b404fdec1a003 Mon Sep 17 00:00:00 2001 From: nalbam Date: Mon, 17 Jun 2024 16:15:38 +0900 Subject: [PATCH 2/2] add gurumi-bot.png --- README.md | 4 ++++ bedrock/invoke_claude_3_image.py | 2 +- {bedrock => images}/gurumi-bot.png | Bin 3 files changed, 5 insertions(+), 1 deletion(-) rename {bedrock => images}/gurumi-bot.png (100%) diff --git a/README.md b/README.md index 17d2ff1..5c0abc0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # lambda-gurumi-ai-bot +A serverless Slack bot using AWS Lambda, API Gateway, and DynamoDB. + +![Gurumi Bot](images/gurumi-bot.png) + ## Install ```bash diff --git a/bedrock/invoke_claude_3_image.py b/bedrock/invoke_claude_3_image.py index d728f66..6a75f9e 100644 --- a/bedrock/invoke_claude_3_image.py +++ b/bedrock/invoke_claude_3_image.py @@ -31,7 +31,7 @@ def invoke_claude_3(prompt): # Invoke Claude 3 with the text prompt model_id = "anthropic.claude-3-sonnet-20240229-v1:0" - image = "./gurumi-bot.png" + image = "../images/gurumi-bot.png" # Read reference image from file and encode as base64 strings. with open(image, "rb") as file: diff --git a/bedrock/gurumi-bot.png b/images/gurumi-bot.png similarity index 100% rename from bedrock/gurumi-bot.png rename to images/gurumi-bot.png