Commit Graph

1222 Commits

Author SHA1 Message Date
Mark VanLandingham 5fec8fe79e
FEATURE: Experimental Private Message Bot Homepage (#1159)
Overview
This PR introduces a Bot Homepage that was first introduced at https://ask.discourse.org/.

Key Features:
Add a bot homepage: /discourse-ai/ai-bot/conversations
Display a sidebar with previous bot conversations
Infinite scroll for large counts
Sidebar still visible when navigation mode is header_dropdown
Sidebar visible on homepage and bot PM show view
Add New Question button to the bottom of sidebar on bot PM show view
Add persona picker to homepage
2025-04-21 15:17:10 -05:00
Keegan George d26c7ac48d
FEATURE: Add spending metrics to AI usage (#1268)
This update adds metrics for estimated spending in AI usage. To make use of it, admins must add cost details to the LLM config page (input, output, and cached input costs per 1M tokens). After doing so, the metrics will appear in the AI usage dashboard as the AI plugin is used.
2025-04-17 15:09:48 -07:00
Keegan George e2b0287333
FEATURE: Enhance LLM context window settings (#1271)
### 🔍 Overview
This update performs some enhancements to the LLM configuration screen. In particular, it renames the UI for the number of tokens for the prompt to "Context window" since the naming can be confusing to the user. Additionally, it adds a new optional field called "Max output tokens".
2025-04-17 14:44:15 -07:00
Martin Brennan 0c8718e0d5
DEV: Update spec for topic tag suggester (#1269)
This second post was not used and is making the topic scroll
down to post 2, which can mess with editing the OP sometimes
2025-04-17 14:06:45 +10:00
Kris 3440395623
DEV: include excerpt-expanded class when gists are enabled (#1267) 2025-04-16 15:26:04 -04:00
Martin Brennan b5d42f373b
DEV: Re-introduce proofreading specs (#1263)
Followup fe7e73a6a4 and
1300cc8a36

Reintroduces proofreader specs and unskips ones skipped when
streaming composer suggestions were added. We just need to make sure
the jobs run immediately in specs because the job is what sends the
MessageBus event to the UI.

Also adds a pageobject method to confirm a diff is shown
in the modal before pressing Confirm button.
2025-04-16 11:11:43 +10:00
Sam 0f34ce999f
FIX: omit thinking tokens from chat (#1264)
* FIX: omit thinking tokens from chat

Thinking tokens cause a lot of confusion in chat, get rid of them

* also catch partial tool just in case
2025-04-15 17:13:20 +10:00
Sam 274a54a324
FEATURE: Update model names and specs (#1262)
* FEATURE: Update model names and specs

- not a bug, but made it explicit that tools and thinking are not a chat thing
- updated all models to latest in presets (Gemini and OpenAI)

* allow larger context windows
2025-04-15 16:33:44 +10:00
Martin Brennan fe7e73a6a4
Revert "DEV: Add test to cover proofreading in rich editor (#1259)" (#1261)
This reverts commit e81108abb6.
2025-04-15 15:58:09 +10:00
Martin Brennan e81108abb6
DEV: Add test to cover proofreading in rich editor (#1259)
This core PR must be merged for this to work
https://github.com/discourse/discourse/pull/32280

We want to make sure we don't have regressions with this
functionality in the rich editor, which uses contendeditable
and other APIs than the old composer.
2025-04-15 14:05:09 +10:00
Keegan George 1300cc8a36
FEATURE: Add streaming to composer helper (#1256)
This update adding streaming to the AI helper inside the composer.
2025-04-14 08:18:50 -07:00
Sam 38b492529f
FEATURE: improve context management (#1260)
1. Add age of post to topic context (1 month ago, 1 year ago, etc)
2. Refactor code for simplicity
3. Fix handling of post context in DMs which was not using new handling of uploads
2025-04-14 21:45:48 +10:00
Sam 67e3a610cb
FIX: invalid context construction for responders (#1257)
Previous to this fix we assumed the name field contained usernames
when in fact it was stored in the id field.

This fixes the context contruction and also adds some basic user
information to the context to assist responders in understanding
the cast of chars
2025-04-12 08:15:31 +10:00
Roman Rizzi df63e36ad8
FEATURE: Make Mixtral tokenizer available for embeddings (#1258) 2025-04-11 12:01:38 -03:00
Keegan George 0024f2d264
FIX: Discovery shouldn't re-trigger when no search (#1255)
This update fixes an issue where discobot discoveries was re-triggering when search menu was opened with no query present.
2025-04-10 10:01:53 -07:00
Keegan George ef08e5ea45
UX: Improve groups list in feature table when many groups (#1254)
This update improves the displaying of groups in the features table when there are many groups for a particular persona.
2025-04-10 09:14:51 -07:00
Keegan George 4de39a07e5
FEATURE: Configure persona backed features in admin panel (#1245)
In this feature update, we add the UI for the ability to easily configure persona backed AI-features. The feature will still be hidden until structured responses are complete.
2025-04-10 08:16:31 -07:00
Keegan George 129ced9088
FIX: Split topic suggester fixes (#1253)
This update fixes a few issues in the split topic suggester. It fixes an issue where not all the category suggestions were appearing in the client. It also fixes an issue where the `move-post` request fails when creating a new topic with only one tag suggestion.
2025-04-09 13:12:34 -07:00
Sam e15984029d
FEATURE: allow tools to amend personas (#1250)
Add API methods to AI tools for reading and updating personas, enabling
more flexible AI workflows. This allows custom tools to:

- Fetch persona information through discourse.getPersona()
- Update personas with modified settings via discourse.updatePersona()
- Also update using persona.update()

These APIs enable new use cases like "trainable" moderation bots, where
users with appropriate permissions can set and refine moderation rules
through direct chat interactions, without needing admin panel access.

Also adds a special API scope which allows people to lean on API
for similar actions

Additionally adds a rather powerful hidden feature can allow custom tools
to inject content into the context unconditionally it can be used for memory and similar features
2025-04-09 15:48:25 +10:00
Discourse Translator Bot 0e4bf298b1
Update translations (#1251) 2025-04-08 13:04:39 -04:00
Loïc Guitaut a2ffe9620a DEV: Add system spec to check core features are working fine 2025-04-08 17:04:20 +02:00
Keegan George 97d36524cd
FIX: search discovery quirks (#1249)
This update fixes a few small quirks with Discobot discoveries:
- [X] subsequent searches should work correctly
- [X] discovery timeout should maintain UI
- [X] key up/down traversal of regular search results should still work
2025-04-07 12:52:23 -07:00
Roman Rizzi f9d641dd3a
FIX: Restore gists previous group access behavior. (#1247)
Previously, allowing "everyone" to access gists meant anons would see them too.
With the move to Personas, we used "[]" to reflect that.

With discourse/discourse#32199 adding the "everyone" option to the personas-allowed
groups, we are switching back to the original behavior.
Leaving allowed groups empty should always mean nobody can use the feature.
2025-04-07 12:04:30 -03:00
Sam ed907dd004
FEATURE: allow to send LLM reports to groups (#1246)
* FEATURE: allow to send LLM reports to groups

* spec regression
2025-04-07 15:31:30 +10:00
Discourse Translator Bot 5ed0990dfc
Update translations (#1235) 2025-04-03 00:05:06 +02:00
Sérgio Saquetim aa5c968b18
DEV: Remove the legacy widget post menu code (#1225) 2025-04-02 22:32:31 +01:00
Roman Rizzi fccd072f44
DEV: Don't use delays for streaming summaries. (#1244)
We started used a callback as a buffer in FoldContent, so the Fake endpoint is attempting
to emulate delays in the streaming. However, we don't care about that in these specs.
2025-04-02 13:38:15 -03:00
Roman Rizzi 0d60aca6ef
FEATURE: Personas powered summaries. (#1232)
* REFACTOR: Move personas into it's own module.

* WIP: Use personas for summarization

* Prioritize persona default LLM or fallback to newest one

* Simplify summarization strategy

* Keep ai_sumarization_model as a fallback
2025-04-02 12:54:47 -03:00
Kris 32da999144
FIX: less generic animation names (#1243) 2025-04-02 11:28:10 -04:00
Sam 8b573fe743
FIX: maintain newest uploads correctly when constructing context (#1242) 2025-04-02 10:09:38 -03:00
Keegan George a14fe929a9
FIX: return false if no current user personas (#1241) 2025-04-01 13:47:39 -07:00
Kris 7b56d7d4fc
UX: adjust artificat UI styles (#1240) 2025-04-01 16:11:36 -04:00
Keegan George f40e094945
FIX: persona setting should compare integer value (#1239)
Oversight from recent feature update: https://github.com/discourse/discourse-ai/pull/1234

We should be comparing integer value of setting, otherwise we will never see continue conversation button.
2025-04-01 11:59:06 -07:00
Keegan George bf5ccb452c
FEATURE: Continue conversation from Discobot discovery (#1234)
This feature update allows for continuing the conversation with Discobot Discoveries in an AI bot chat. After discoveries gives you a response to your search you can continue with the existing context.
2025-04-01 10:22:39 -07:00
Kris 5331b6dd8e
UX: wider search pane, border, smaller font size (#1238) 2025-04-01 12:57:32 -04:00
David Taylor fb68ae9698
DEV: Drop widget post-menu spec (#1236)
In preparation for https://github.com/discourse/discourse/pull/31211
2025-04-01 15:41:56 +01:00
Roman Rizzi 30242a27e6
REFACTOR: Move personas into its own module. (#1233)
This change moves all the personas code into its own module. We want to treat them as a building block features can built on top of, same as `Completions::Llm`.

The code to title a message was moved from `Bot` to `Playground`.
2025-03-31 14:42:33 -03:00
Sam 5b6d39a206
FEATURE: flexible image handling within messages (#1214)
* DEV: refactor bot internals

This introduces a proper object for bot context, this makes
it simpler to improve context management as we go cause we
have a nice object to work with

Starts refactoring allowing for a single message to have
multiple uploads throughout

* transplant method to message builder

* chipping away at inline uploads

* image support is improved but not fully fixed yet

partially working in anthropic, still got quite a few dialects to go

* open ai and claude are now working

* Gemini is now working as well

* fix nova

* more dialects...

* fix ollama

* fix specs

* update artifact fixed

* more tests

* spam scanner

* pass more specs

* bunch of specs improved

* more bug fixes.

* all the rest of the tests are working

* improve tests coverage and ensure custom tools are aware of new context object

* tests are working, but we need more tests

* resolve merge conflict

* new preamble and expanded specs on ai tool

* remove concept of "standalone tools"

This is no longer needed, we can set custom raw, tool details are injected into tool calls
2025-03-31 12:39:07 -03:00
Keegan George f3e78f0d80
FIX: Search discoveries improvements (#1228)
**This update makes a few improvements to search discoveries:**
- [x] in search menu panel: search discoveries should still be triggered when no regular results are present
- [x] in full page search: search discoveries should still be triggered when no regular results are present
- [x] flakiness in search discoveries sometimes not working properly.

---------

Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
2025-03-31 08:38:40 -07:00
Joffrey JAFFEUX 28fa723472
FIX: forced tools wasn't set correctly when tool has no options. (#1231)
* wip: more dynamic availableForcedTools

* FIX: forced tools wasn't set correctly when tool has no options.

---------

Co-authored-by: Roman Rizzi <rizziromanalejandro@gmail.com>
2025-03-31 10:45:03 -03:00
Roman Rizzi f43137e067
UX: Show AI bot toggles in the AI bot options section (#1229) 2025-03-27 16:46:35 -03:00
Keegan George da2b083025
FIX: attempt to fix flaky (#1226)
The AI Tool spec that checks that the tool runner will not timeout on slow HTTP request is flaky. In this PR we attempt to resolve the flakiness by:

Ensuring stub_request runs before the request
Increasing the timeout for CI env
2025-03-27 09:34:42 -07:00
Keegan George 6827d63e30
DEV: Streaming animation API for components (#1224)
This takes the logic used in summarization/discoveries for streaming and consolidates it into a single helper lib for smooth streaming. It introduces a new lib: `SmoothStreamer` that can be used by components for smooth streaming text from message bus updates. Additionally, the PR makes use of that new lib in the AI post menu helper.
2025-03-27 08:06:33 -07:00
Keegan George 60fe924ce0
DEV: Remove no longer needed click outside logic (#1223)
The older design approach for sentiment analysis report needed the click outside logic. However, when the design was changed this logic was accidentally left behind. It is potentially causing some negative performance impacts. This PR removes the old unnecessary logic.
2025-03-26 14:24:02 -07:00
Keegan George bab6f0be43
FIX: Ensure category badging present in sentiment reports (#1222)
This PR ensures that the category badges are present in the sentiment analysis report. Since the core change in https://github.com/discourse/discourse/pull/31795, there was a regression in the post list drill-down where category badges were not being shown. This PR fixes that and also ensures icons/emojis are shown when categories make use of them. This PR also adds the category badge in the table list.
2025-03-26 12:37:41 -07:00
Roman Rizzi 1b05da704e
FIX: Persona editor keeps dirty data after persisting a single field (#1219) 2025-03-26 15:36:01 -03:00
Keegan George 371146cdfe
FIX: Post helper menu results should be selectable (#1221)
This update fixes an issue where the results of the post helper menu was not selectable. Previously, selecting any text inside the menu was immediately closing the menu.
2025-03-26 11:28:57 -07:00
Roman Rizzi a6b08270c0
DEV: GH CI needs discourse-solved (#1220) 2025-03-26 10:12:55 -03:00
Joffrey JAFFEUX 9a752eff29
FIX: do not error when tools are empty (#1218) 2025-03-26 10:42:43 +01:00
Joffrey JAFFEUX 913314b67d
FIX: prevents to call Object.keys on null (#1217)
This was causing errors in the forms under specific cases.
2025-03-25 22:35:41 +01:00