1143 Commits

Author SHA1 Message Date
Keegan George
b17c688162
DEV: Improve title suggester suggestions when editing topic (#1182)
This update ensures topic title suggestions when suggesting from edit topic take into account the whole topic for more accurate title suggestions.
2025-03-11 11:16:06 -07:00
Discourse Translator Bot
e59184b65c
Update translations (#1185) 2025-03-11 17:47:51 +01:00
Sam
8f4cd2fcbd
FEATURE: allow disabling of top_p and temp for thinking models (#1184)
thinking models such as Claude 3.7 Thinking and o1 / o3 do not
support top_p or temp.

Previously you would have to carefully remove it from everywhere
by having it be a provider param we now support blanker removing
without forcing people to update automation rules or personas
2025-03-11 16:54:02 +11:00
Guhyoun Nam
f4708d4178
DEV: Ai summary utilizing name instead of username (#1180)
* DEV: Ai summary utilizing name instead of username

* utilize username if name not available

* test added

* test added 2
2025-03-11 14:29:13 +11:00
dependabot[bot]
833f914e34
Build(deps-dev): Bump rack from 3.1.10 to 3.1.12 (#1181)
Bumps [rack](https://github.com/rack/rack) from 3.1.10 to 3.1.12.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/v3.1.10...v3.1.12)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-11 14:27:34 +11:00
Sam
168d9d8eb9
FIX: AI triage support and refactor search functionality (#1175)
* FIX: do not add bot user to PM when using responders

* Allow AI tool to call search directly

* remove stray p
2025-03-11 14:26:07 +11:00
Krzysztof Kotlarek
3da4f5eac3
DEV: fix Zeitwerk issue with SpamScanner class (#1183)
When spam scanner is enabled and code is reloaded, developer experience this error:

```
NameError at /posts
===================

uninitialized constant DiscourseAi::AiModeration::EntryPoint::SpamScanner

> To access an interactive console with this error, point your browser to: /__better_errors

plugins/discourse-ai/lib/ai_moderation/entry_point.rb, line 7
```

It is because when we call `SpamScanner` it is searched within parent `DiscourseAi::AiModeration::EntryPoint` namespace.

We can help a bit Zeitwerk by calling SpamScanner more explicitly.
2025-03-11 13:24:27 +11:00
Keegan George
bb32d0d737
FEATURE: Add ability to disable search discoveries (#1177)
This update adds the ability to disable search discoveries. This can be done through a tooltip when search discoveries are shown. It can also be done in the AI user preferences, which has also been updated to accommodate more than just the one image caption setting.
2025-03-10 14:17:58 -07:00
Joffrey JAFFEUX
339251a371
FIX: prevents double escaping of filters (#1179)
---------

Co-authored-by: Keegan George <kgeorge13@gmail.com>
2025-03-10 14:17:24 -07:00
Rafael dos Santos Silva
511b10285d
DEV: rake task to populate sentiment in dev env (#1176) 2025-03-10 14:21:00 -03:00
Keegan George
94e0834b88
DEV: Sentiment follow-up updates (#1172)
###  What's new?
- [X] show sentiment counts by color on doughnut without needing to hover
- [X] minor UI padding adjustments
- [X] hide filters that are not allowed to be adjusted in selected chart view
- [X] fix z-index issues with drill-down filters
2025-03-10 09:25:55 -07:00
Roman Rizzi
1ce25c5a8b
DEV: Don't classify post sentiments on creation. (#1174)
We'll rely on the backfill instead, which runs every five minutes. Bump default batch size x10 to avoid lagging.
2025-03-07 14:45:10 -03:00
David Taylor
1b570fcd01
PERF: Move sentiment analysis to "low" sidekiq queue (#1173) 2025-03-07 14:12:15 +00:00
Natalie Tay
5b63e597d0
DEV: A rake task to generate topics (#1171)
Adds a new rake task to generate topics using the AI helper model.

Generate topics using 
```
bundle exec rake "ai:generate_topics[Don Quijote de la Mancha\, Cien años de soledad\, Os Lusíadas\,三国演义]"
```

For now it randomly chooses a non-read-restricted category and a random bunch of users.
2025-03-06 22:25:50 +08:00
Sam
01893bb6ed
FEATURE: Add persona-based replies and whisper support to LLM triage (#1170)
This PR enhances the LLM triage automation with several important improvements:

- Add ability to use AI personas for automated replies instead of canned replies
- Add support for whisper responses
- Refactor LLM persona reply functionality into a reusable method
- Add new settings to configure response behavior in automations
- Improve error handling and logging
- Fix handling of personal messages in the triage flow
- Add comprehensive test coverage for new features
- Make personas configurable with more flexible requirements

This allows for more dynamic and context-aware responses in automated workflows, with better control over visibility and attribution.
2025-03-06 17:18:15 +11:00
Sam
453bb4821f
DEV: fix build (#1168) 2025-03-06 11:19:14 +11:00
Sam
e255c7a8f0
FEATURE: automation triage using personas (#1126)
## LLM Persona Triage
- Allows automated responses to posts using AI personas
- Configurable to respond as regular posts or whispers
- Adds context-aware formatting for topics and private messages
- Provides special handling for topic metadata (title, category, tags)

## LLM Tool Triage
- Enables custom AI tools to process and respond to posts
- Tools can analyze post content and invoke personas when needed
- Zero-parameter tools can be used for automated workflows
- Not enabled in production yet

## Implementation Details
- Added new scriptable registration in discourse_automation/ directory
- Created core implementation in lib/automation/ modules
- Enhanced PromptMessagesBuilder with topic-style formatting
- Added helper methods for persona and tool selection in UI
- Extended AI Bot functionality to support whisper responses
- Added rate limiting to prevent abuse

## Other Changes
- Added comprehensive test coverage for both automation types
- Enhanced tool runner with LLM integration capabilities
- Improved error handling and logging

This feature allows forum admins to configure AI personas to automatically respond to posts based on custom criteria and leverage AI tools for more complex triage workflows.

Tool Triage has been disabled in production while we finalize details of new scripting capabilities.
2025-03-06 09:41:09 +11:00
Keegan George
8863cf0c86
DEV: Updates to sentiment analysis reports (#1161)
**This PR includes a variety of updates to the Sentiment Analysis report:**
- [X] Conditionally showing sentiment reports based on `sentiment_enabled` setting
- [X] Sentiment reports should only be visible in sidebar if data is in the reports
- [X] Fix infinite loading of posts in drill down
- [x] Fix markdown emojis showing not showing as emoji representation
- [x] Drill down of posts should have URL
- [x] ~~Different doughnut sizing based on post count~~ [reverting and will address in follow-up (see: `/t/146786/47`)]
- [X] Hide non-functional export button 
- [X] Sticky drill down filter nav
2025-03-05 13:53:56 -08:00
Kelv
b49d454ad9
DEV: update display name field in AiLlmEditorForm to show more relevant tooltip (#1166) 2025-03-05 16:49:19 +08:00
Ted Johansson
584f5f2b6e
DEV: Use full URL for problem check message (#1165)
Better to construct the URL in Ruby and pass it to I18n, so we don't have to mess with the translations if the URL changes.
2025-03-05 11:31:23 +08:00
Discourse Translator Bot
fff0bc0f8c
Update translations (#1164) 2025-03-04 16:12:06 +01:00
Sam
28af4434c5
Dev: eval improvements (#1162)
Adds sonnet 3.7
Adds support for temp in eval framework
2025-03-04 16:12:25 +11:00
Sam
f6eedf3e0b
FEATURE: implement thinking token support (#1155)
adds support for "thinking tokens" - a feature that exposes the model's reasoning process before providing the final response. Key improvements include:

- Add a new Thinking class to handle thinking content from LLMs
- Modify endpoints (Claude, AWS Bedrock) to handle thinking output
- Update AI bot to display thinking in collapsible details section
- Fix SEARCH/REPLACE blocks to support empty replacement strings and general improvements to artifact editing
- Allow configurable temperature in triage and report automations
- Various bug fixes and improvements to diff parsing
2025-03-04 12:22:30 +11:00
Martin Brennan
3f20b24aa3
FIX: Use route for admin sentiment sidebar links (#1160)
Minor, but there is a core bug when using `href` at the moment,
this fixes the issue, and I will do more in core separately.
2025-03-03 15:37:45 +10:00
Kris
5368b0c7d0
UX: add links to sentiment to admin sidebar (#1158) 2025-02-28 15:29:04 -05:00
Rafael dos Santos Silva
eccfbad046
UX: Update Sambanova LLM templates (#1157) 2025-02-28 15:00:15 -03:00
Keegan George
a3fb5cdc21
FIX: Subsequent results in full page search should re-trigger discovery (#1156)
This update fixes an issue where subsequent results in full page search were not trigger Discobot discoveries to search for the new result.
2025-02-27 10:18:42 -08:00
Keegan George
e15952031d
UX: Smoother streaming for discoveries (#1154)
## 🔍 Overview
This update ensures that the streaming for discoveries is smoother, especially on first update.


##  More details
To help with smoother streaming, the discovery preview (which was being tracked as a separate property in the JS logic) will be removed and the entire discovery content will be shown/hidden via the existing CSS. The preview was already receiving the full update even though it was visually hidden, so removing the separate property shouldn't have any negative performance hit. Visually hiding it with CSS only will help simplify the component and also allow for smoother streaming. We will instead remove the buffered streaming approach and instead use typing timers similar to what we did for streaming summarization. 

No related tests as streaming animations are difficult to test.
2025-02-27 07:32:39 -08:00
Martin Brennan
aa13d16022
UX: Add description to configuration nav (#1153)
This will be used in the new admin search UI
2025-02-26 10:54:45 +10:00
Keegan George
9aafca03f5
UX: Improvements to sentiment analysis report (#1150)
This update improves some of the UI around sentiment analysis reports:

1. Improve titles so it is above and truncated when long
2. Change doughnut to only show total count
3. Ensures sentiment posts have dates
4. Ensure expand post doesn't appear on short posts
2025-02-25 07:47:30 -08:00
Discourse Translator Bot
0018475987
Update translations (#1152) 2025-02-25 15:11:37 +01:00
Sam
fe19133dd4
FEATURE: full support for Sonnet 3.7 (#1151)
* FEATURE: full support for Sonnet 3.7

- Adds support for Sonnet 3.7 with reasoning on bedrock and anthropic
- Fixes regression where provider params were not populated

Note. reasoning tokens are hardcoded to minimum of 100 maximum of 65536

* FIX: open ai non reasoning models need to use deprecate max_tokens
2025-02-25 17:32:12 +11:00
Sam
84e791a941
FIX: legacy reasoning models not working, missing provider params (#1149)
* FIX: legacy reasoning models not working, missing provider params

1. Legacy reasoning models (o1-preview / o1-mini) do not support developer or system messages, do not use them.
2. LLM editor form not showing all provider params due to missing remap

* add system test
2025-02-24 16:38:23 +11:00
Natalie Tay
2486e0e2dd
DEV: Extract configs to a yml file and allow local config (#1142) 2025-02-24 16:22:19 +11:00
Keegan George
08377bab35
DEV: Sentiment analysis report follow-up updates (#1145)
* DEV: make include subcategories checkbox operational

* DEV: add pagination for post requests

* WIP: selected chart UX improvements

* DEV: Functional sentiment filters

* DEV: Reset filters after going back

* DEV: Add category colors, improve UX

* DEV: Update spec
2025-02-24 16:21:10 +11:00
Discourse Translator Bot
43cbb7f45f
Update translations (#1148) 2025-02-24 16:20:25 +11:00
Jarek Radosz
4f94675a72
DEV: Update license (#1147) 2025-02-24 11:20:06 +08:00
Kris
55dde0a9e6
UX: minor adjustments to search bot (#1146) 2025-02-21 19:40:53 -05:00
Roman Rizzi
09f4895302
UI: Custom icon for Discobot discoveries (#1144) 2025-02-21 12:22:36 -03:00
Rafael dos Santos Silva
04678cab04
FIX: Discovery search would break normal search for anons (#1143) 2025-02-21 12:14:47 -03:00
Roman Rizzi
f922012499
UX: Display a tooltip signalling this is an AI powered feature (#1141) 2025-02-20 16:21:26 -03:00
Roman Rizzi
6765a13a40
FEATURE: Experimental search results from an AI Persona. (#1139)
* FEATURE: Experimental search results from an AI Persona.

When a user searches discourse, we'll send the query to an AI Persona to provide additional context and enrich the results. The feature depends on the user being a member of a group to which the persona has access.

* Update assets/stylesheets/common/ai-blinking-animation.scss

Co-authored-by: Keegan George <kgeorge13@gmail.com>

---------

Co-authored-by: Keegan George <kgeorge13@gmail.com>
2025-02-20 14:37:58 -03:00
Keegan George
24f0e1262d
FEATURE: New sentiment analysis visualization report (#1109)
## 🔍 Overview
This update adds a new report page at `admin/reports/sentiment_analysis` where admins can see a sentiment analysis report for the forum grouped by either category or tags. 

##  More details
The report can breakdown either category or tags into positive/negative/neutral sentiments based on the grouping (category/tag). Clicking on the doughnut visualization will bring up a post list of all the posts that were involved in that classification with further sentiment classifications by post. 

The report can additionally be sorted in alphabetical order or by size, as well as be filtered by either category/tag based on the grouping.

## 👨🏽‍💻 Technical Details
The new admin report is registered via the pluginAPi with `api.registerReportModeComponent` to register the custom sentiment doughnut report. However, when each doughnut visualization is clicked, a new endpoint found at: `/discourse-ai/sentiment/posts` is fetched to showcase posts classified by sentiments based on the respective params.


## 📸 Screenshots
![Screenshot 2025-02-14 at 11 11 35](https://github.com/user-attachments/assets/a63b5ab8-4fb2-477d-bd29-92545f44ff09)
2025-02-20 09:14:10 -08:00
Keegan George
1f9f330ce2
DEV: Add summarization type to eval (#1138)
Adds `type: summarization` for topic summarization eval: https://github.com/discourse/discourse-ai-evals/pull/4
2025-02-20 09:07:23 -08:00
Roman Rizzi
70248ccfca
DEV: Update annotations for models using Core tables (#1140) 2025-02-20 11:49:50 -03:00
Keegan George
af47873f28
FIX: hardcoded require for evals (#1137)
The require for `discourse/config/environment` should point to the local user's core Discourse environment instead of the hardcoded path for Sam's env.
2025-02-19 11:56:52 -08:00
Rafael dos Santos Silva
37bf160d26
FIX: Add workaround to pgvector HNSW search limitations (#1133)
From [pgvector/pgvector](https://github.com/pgvector/pgvector) README

> With approximate indexes, filtering is applied after the index is scanned. If a condition matches 10% of rows, with HNSW and the default hnsw.ef_search of 40, only 4 rows will match on average. For more rows, increase hnsw.ef_search.
> 
> Starting with 0.8.0, you can enable [iterative index scans](https://github.com/pgvector/pgvector#iterative-index-scans), which will automatically scan more of the index when needed.


Since we are stuck on 0.7.0 we are going the first option for now.
2025-02-19 16:30:01 -03:00
Kris
3a755ca883
DEV: add summary button wrapper removed from core (#1136) 2025-02-19 12:58:10 -05:00
Sam
12f00a62d2
FIX: use max_completion_tokens for open ai models (#1134)
max_tokens is now deprecated per API
2025-02-19 15:49:15 +11:00
Sam
0c9466059c
DEV: improve artifact editing and eval system (#1130)
- Add non-contiguous search/replace support using ... syntax
- Add judge support for evaluating LLM outputs with ratings
- Improve error handling and reporting in eval runner
- Add full section replacement support without search blocks
- Add fabricators and specs for artifact diffing
- Track failed searches to improve debugging
- Add JS syntax validation for artifact versions in eval system
- Update prompt documentation with clear guidelines

* improve eval output

* move error handling

* llm as a judge

* fix spec

* small note on evals
2025-02-19 15:44:33 +11:00