Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1cdb1eb
Refactor event handling and add configuration files for environment v…
techwithanirudh May 22, 2025
324dcdc
refactor: update TypeScript configuration and improve type imports
techwithanirudh May 22, 2025
f3911a1
Refactor chat message handling: rename postMessage to sendMessage, up…
techwithanirudh May 22, 2025
f6526b5
feat: Enhance bot functionality and improve response generation
techwithanirudh May 22, 2025
58fee3d
Refactor: Remove unused imports and commented out code
techwithanirudh May 22, 2025
4b88c92
feat: Update bot personality and response style; fix username referen…
techwithanirudh May 23, 2025
83acfe2
feat: Add biome configuration file; update response generation for Di…
techwithanirudh May 23, 2025
48851f7
fix: standardize import statements and formatting across type files
techwithanirudh May 23, 2025
15cc5b6
feat: Add thread handling capabilities; enhance message structures an…
techwithanirudh May 23, 2025
0febdb8
feat: Implement thread and message handling; add API endpoints for fe…
techwithanirudh May 23, 2025
8720411
feat: Update environment configuration; add Discourse credentials and…
techwithanirudh May 23, 2025
396349d
feat: add initial server setup with API, configuration, and environme…
techwithanirudh May 23, 2025
9997555
refactor: standardize request handling and improve error messages in …
techwithanirudh May 23, 2025
e988669
feat: add logging for replies in message handling and app mention fun…
techwithanirudh May 23, 2025
12a3ae9
feat: prepend username to message content in getMessages and getThrea…
techwithanirudh May 23, 2025
43081a2
feat: include user name in message content format in getMessages func…
techwithanirudh May 23, 2025
a6f31d6
feat: rename Slackbot to Discourse Chatbot and update related utilities
techwithanirudh May 23, 2025
1aa134f
Refactor event handling and AI response generation
techwithanirudh May 23, 2025
59fd746
feat: remove run script and add event handling for Discourse notifica…
techwithanirudh May 24, 2025
a90825f
feat: refactor discourse utilities and update imports for better orga…
techwithanirudh May 24, 2025
d9ce7c7
feat: enhance AI functionality and logging
techwithanirudh May 24, 2025
1fb40b7
feat: implement event handling for Discourse notifications and chat m…
techwithanirudh May 24, 2025
da94345
ev
techwithanirudh May 24, 2025
adda7e0
feat: reorganize discourse utilities and enhance event handling for c…
techwithanirudh May 24, 2025
fdd7fd5
feat: refactor imports and improve code organization in event and uti…
techwithanirudh May 24, 2025
4601ee4
feat: enhance event handling by adding logging for AI requests in mes…
techwithanirudh May 24, 2025
7dd8617
feat: update event handling to streamline processing and improve mess…
techwithanirudh May 24, 2025
29eb20a
feat: update comments to clarify notification handling in message create
techwithanirudh May 24, 2025
d12c857
feat: modify message response format and update AI provider integration
techwithanirudh May 24, 2025
7ae3367
feat: modify message response format and update AI provider integration
techwithanirudh May 24, 2025
0fe20f2
feat: enhance message handling with staggered replies and improved me…
techwithanirudh May 25, 2025
6f7e6f5
feat: integrate Upstash for rate limiting and Redis support, enhance …
techwithanirudh May 27, 2025
3a781b5
feat: add event handling and API status endpoint for Discourse integr…
techwithanirudh May 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
11 changes: 7 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Slack Credentials
# Get these from your Slack app configuration at https://api.slack.com/apps
DISCOURSE_BOT_TOKEN=xoxb-your-bot-token # Bot User OAuth Token from OAuth & Permissions
# Discourse Credentials
# Get these from your Discourse Forum

# Bot User OAuth Token from OAuth & Permissions
DISCOURSE_BOT_TOKEN=your-bot-token
DISCOURSE_URL=https://community.yourdomain.com/
DISCOURSE_SIGNING_SECRET=your-signing-secret # Signing Secret from Basic Information
# Signing Secret from Basic Information
DISCOURSE_SIGNING_SECRET=your-signing-secret

# OpenAI Credentials
# Get this from your OpenAI account at https://platform.openai.com/api-keys
Expand Down
43 changes: 38 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
# dependencies (bun install)
node_modules
.env
ai-context

# output
out
dist
.vercel
.env*.local
.pnpm-store
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store

# misc
.data
.nitro
.cache
.output
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AI SDK Slackbot
# AI SDK Discourse Chatbot

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fnicoalbanese%2Fai-sdk-slackbot&env=DISCOURSE_BOT_TOKEN,DISCOURSE_SIGNING_SECRET,OPENAI_API_KEY,EXA_API_KEY&envDescription=API%20keys%20needed%20for%20application&envLink=https%3A%2F%2Fgithub.com%2Fnicoalbanese%2Fai-sdk-slackbot%3Ftab%3Dreadme-ov-file%234-set-environment-variables&project-name=ai-sdk-slackbot)

Expand Down
20 changes: 20 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
discourse-2 chat openapi is broken it doesn't have proper spec it thinks that in the const initialMessage = await client.postMessage({
channel_id: event.channel?.id,
// thread_ts: event.thread_ts ?? event.ts,
message: initialStatus,
});

has a .message.id instead of a message_id

https://github.com/nitrojs/nitro/discussions/1356
put something like bro instead of thinking and in final response add the bro at the beggign have words like that
have a matching list or smth like lol is rofl like that ok
or just use the typing indicator in discourse figure out
- make the starting message different randomzie like bro, lmao like that through keyword recognition, now it is fixed to bro, make it a setting
- add mem0 support for adding memories
- add ability for it to reply in posts
- add staggered reply tokenize msgs
- use the prompts.ts and add request hints
- do the relevance check
- set custom status like discord bto does like online offline and custom status msgg
- mark deleted messages as deleted so the ai know why it responded, same with edited messages
47 changes: 0 additions & 47 deletions api/events.ts

This file was deleted.

37 changes: 37 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"organizeImports": {
"enabled": true
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignore": ["node_modules"]
},
"formatter": {
"enabled": true,
"formatWithErrors": true,
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"enabled": true,
"quoteStyle": "single",
"jsxQuoteStyle": "single",
"semicolons": "always"
}
},
"linter": {
"enabled": true,
"rules": {
"correctness": {
"noUnusedImports": "error"
},
"recommended": true
}
}
}
Loading