Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d5222d4
f
techwithanirudh May 22, 2025
14a7ed2
f
techwithanirudh May 22, 2025
3cd7c48
f
techwithanirudh May 22, 2025
fb56b16
ff
techwithanirudh May 22, 2025
4b7b645
f
techwithanirudh May 22, 2025
d922537
f
techwithanirudh May 22, 2025
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
6108097
Merge pull request #1 from techwithanirudh/nitro
techwithanirudh May 27, 2025
fe23142
f
techwithanirudh May 27, 2025
91a3a1e
feat: refactor logger initialization to improve environment handling …
techwithanirudh May 27, 2025
186bb61
f
techwithanirudh May 27, 2025
d290534
feat
techwithanirudh May 27, 2025
fda5c32
fix: update import paths to use tilde for module resolution
techwithanirudh May 27, 2025
c4a4b77
feat: enhance environment handling and logging configuration in Nitro…
techwithanirudh May 28, 2025
5afd587
fix
techwithanirudh May 28, 2025
d9149a0
feat: add route rules for API proxying in Nitro configuration
techwithanirudh May 28, 2025
3bf42af
Update prompts.ts
techwithanirudh Jun 5, 2025
3e99174
Update prompts.ts
techwithanirudh Jun 5, 2025
2a591ef
Merge branch 'main' of https://github.com/techwithanirudh/ai-sdk-disc…
techwithanirudh Jun 24, 2025
801d2eb
Merge branch 'nitro' of https://github.com/techwithanirudh/ai-sdk-dis…
techwithanirudh Jun 24, 2025
7b7458a
feat
techwithanirudh Jun 24, 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
12 changes: 8 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Slack Credentials
# Get these from your Slack app configuration at https://api.slack.com/apps
SLACK_BOT_TOKEN=xoxb-your-bot-token # Bot User OAuth Token from OAuth & Permissions
SLACK_SIGNING_SECRET=your-signing-secret # Signing Secret from Basic Information
# 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/
# 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
42 changes: 38 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
# dependencies (bun install)
node_modules
.env
ai-context

# output
out
dist
.vercel
.env*.local
*.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.

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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=SLACK_BOT_TOKEN,SLACK_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)
[![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)

An AI-powered chatbot for Slack powered by the [AI SDK by Vercel](https://sdk.vercel.ai/docs).

Expand Down Expand Up @@ -42,7 +42,7 @@ pnpm install
### 3. Configure Slack App Settings

- Go to "Basic Information"
- Under "App Credentials", note down your "Signing Secret". This will be an environment variable `SLACK_SIGNING_SECRET`
- Under "App Credentials", note down your "Signing Secret". This will be an environment variable `DISCOURSE_SIGNING_SECRET`
- Go to "App Home"
- Under Show Tabs -> Messages Tab, Enable "Allow users to send Slash commands and messages from the messages tab"
- Go to "OAuth & Permissions"
Expand All @@ -53,7 +53,7 @@ pnpm install
- `im:history`
- `im:read`
- `im:write`
- Install the app to your workspace and note down the "Bot User OAuth Token" for the environment variable `SLACK_BOT_TOKEN`
- Install the app to your workspace and note down the "Bot User OAuth Token" for the environment variable `DISCOURSE_BOT_TOKEN`

- Go to "Event Subscriptions"
- Enable Events
Expand All @@ -76,8 +76,8 @@ Create a `.env` file in the root of your project with the following:

```
# Slack Credentials
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
DISCOURSE_BOT_TOKEN=xoxb-your-bot-token
DISCOURSE_SIGNING_SECRET=your-signing-secret

# OpenAI Credentials
OPENAI_API_KEY=your-openai-api-key
Expand Down Expand Up @@ -119,8 +119,8 @@ Make sure to modify the [subscription URL](./README.md/#enable-slack-events) to

3. Add your environment variables in the Vercel project settings:

- `SLACK_BOT_TOKEN`
- `SLACK_SIGNING_SECRET`
- `DISCOURSE_BOT_TOKEN`
- `DISCOURSE_SIGNING_SECRET`
- `OPENAI_API_KEY`
- `EXA_API_KEY`

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
51 changes: 0 additions & 51 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