1231 Commits

Author SHA1 Message Date
Sam
65718f6dbe
FIX: eat all leading spaces llms provide when they stream them (#1280)
* FIX: eat all leading spaces llms provide when they stream them

* improve so we don't stop replying...
2025-04-24 22:07:26 +10:00
Sam
2060426709
FIX: guard against situations where there is no reply, pass thread id (#1279) 2025-04-24 20:31:14 +10:00
Sam
2a5c60db10
FEATURE: display more places where AI is used / Chat streamer (#1278)
* FEATURE: display more places where AI is used

- Usage was not showing automation or image caption in llm list.
- Also: FIX - reasoning models would time out incorrectly after 60 seconds (raised to 10 minutes)

* correct enum not to enumerate non configured models

* FEATURE: implement chat streamer

This implements a basic chat streamer, it provides 2 things:

1. Gives feedback to the user when LLM is generating
2. Streams stuff much more efficiently to client (given it may take 100ms or so per call to update chat)
2025-04-24 16:22:19 +10:00
Jordan Vidrine
e1731dc3df
UX: Align styling with conventions (#1275) 2025-04-23 14:14:55 -05:00
Rafael dos Santos Silva
4470e8af9b
FIX: Tables should group only per their key on usage page (#1277) 2025-04-23 15:47:34 -03:00
Mark VanLandingham
86f82ea4d3
FIX: Do not re-render conversations sidebar on navigation (#1274) 2025-04-23 15:37:15 +10:00
Joffrey JAFFEUX
d2002f81a7
DEV: migrates tools form to form-kit (#1204)
This PR is a retry of: #1135, where we migrate AiTools form to FormKit. The previous PR accidentally removed code related to setting enum values, and as a result was reverted. This update includes enums correctly along with the previous updates.
2025-04-22 09:23:25 -07:00
Isaac Janzen
e8b0f86300
FEATURE: Bot Conversation Homepage (#1273) 2025-04-22 10:22:03 -05:00
Mark VanLandingham
244ec9d61e
REVERT: "FEATURE: Experimental Private Message Bot Homepage (#1159)" (#1272)
This reverts commit 5fec8fe79eeac7dae40013ff05f07ef18b568e38.
2025-04-21 16:42:05 -05:00
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 fe7e73a6a436795c053a611884431f663f4bdd27 and
1300cc8a36dc33870f0d3c81e1e1a21a93e1f1de

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 e81108abb6819d36eb3c6b9f539c56eb47d34e59.
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