Skip to content

Commit

Permalink
fix: limit discord thread name (#1013)
Browse files Browse the repository at this point in the history
* fix: limit discord thread name

* fix: handle start of thread with blank message
  • Loading branch information
desaxce authored May 23, 2024
1 parent 2c74e4d commit f158482
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
5 changes: 4 additions & 1 deletion backend/chainlit/discord/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,11 @@ async def on_message(message: discord.Message):
elif isinstance(message.channel, discord.GroupChannel):
thread_name = f"{message.channel.name}"
elif isinstance(message.channel, discord.TextChannel):
# Discord limits thread names to 100 characters and does not create
# threads from empty messages.
discord_thread_name = clean_content(message)[:100] or "Untitled"
channel = await message.channel.create_thread(
name=clean_content(message), message=message
name=discord_thread_name, message=message
)
thread_name = f"{channel.name}"
else:
Expand Down
37 changes: 19 additions & 18 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
[tool.poetry]
name = "chainlit"
version = "1.1.202"
keywords = ['LLM', 'Agents', 'gen ai', 'chat ui', 'chatbot ui', 'openai', 'copilot', 'langchain', 'conversational ai']
keywords = [
'LLM',
'Agents',
'gen ai',
'chat ui',
'chatbot ui',
'openai',
'copilot',
'langchain',
'conversational ai',
]
description = "Build Conversational AI."
authors = ["Chainlit"]
license = "Apache-2.0 license"
repository = "https://github.com/Chainlit/chainlit"
readme = "README.md"
exclude = [
"**/frontend/**/*",
"**/copilot/**/**/",
]
include = [
"**/frontend/dist/**/*",
"**/copilot/dist/**/*",
]
exclude = ["**/frontend/**/*", "**/copilot/**/**/"]
include = ["**/frontend/dist/**/*", "**/copilot/dist/**/*"]

[tool.poetry.scripts]
# command_name = module_for_handler : function_for_handler
Expand All @@ -38,7 +42,7 @@ tomli = "^2.0.1"
pydantic = ">=1,<3"
python-dotenv = "^1.0.0"
uptrace = "^1.22.0"
watchfiles="^0.20.0"
watchfiles = "^0.20.0"
filetype = "^1.2.0"
lazify = "^0.4.0"
packaging = "^23.1"
Expand All @@ -56,6 +60,9 @@ transformers = "^4.30.1"
matplotlib = "3.7.1"
farm-haystack = "^1.18.0"
plotly = "^5.18.0"
slack_bolt = "^1.18.1"
discord = "^2.3.2"


[tool.poetry.group.mypy]
optional = true
Expand All @@ -78,15 +85,15 @@ module = [
"haystack.*",
"langflow",
"lazify",
"matplotlib.*", # remove when 3.8.0 is out, it should export types
"matplotlib.*", # remove when 3.8.0 is out, it should export types
"plotly.*",
"nest_asyncio",
"socketio.*",
"uptrace",
"syncer",
"vertexai.language_models",
"vertexai.preview.generative_models",
"google.cloud"
"google.cloud",
]
ignore_missing_imports = true

Expand All @@ -100,12 +107,6 @@ boto3 = "^1.34.73"
azure-identity = "^1.14.1"
azure-storage-file-datalake = "^12.14.0"

[tool.poetry.group.slack.dependencies]
slack_bolt = "^1.18.1"

[tool.poetry.group.discord.dependencies]
discord = "^2.3.2"


[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit f158482

Please sign in to comment.