Commit Graph

1288 Commits

Author SHA1 Message Date
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
Keegan George 9dfae3d472
UX: Convert sentiment analysis overview to horizontal bars (#1216)
The sentiment analysis report page initially showcases sentiments via category/tag by doughnut visualizations. However, this isn't an optimal view for quickly scanning and comparing each result. This PR updates the overview to include a table visualization with horizontal bars to represent sentiment analysis instead of doughnuts. Doughnut visualizations are still maintained however when accessing the sentiment data in the drill down for individual entries.

This approach is an intermediary step, as we will eventually add whole clustering and sizing visualization instead of a table. As such, no relevant tests are added in this PR.
2025-03-25 13:36:52 -07:00
Discourse Translator Bot 76a48786d9
Update translations (#1215) 2025-03-25 17:23:09 +01:00
Natalie Tay f7536181af
DEV: Update solved report due to changes in solved plugin (#1212) 2025-03-25 15:15:30 +08:00
Sam 1dde82eb58
FEATURE: allow specifying tool use none in completion prompt
This PR adds support for disabling further tool calls by setting tool_choice to :none across all supported LLM providers:

- OpenAI: Uses "none" tool_choice parameter
- Anthropic: Uses {type: "none"} and adds a prefill message to prevent confusion
- Gemini: Sets function_calling_config mode to "NONE"
- AWS Bedrock: Doesn't natively support tool disabling, so adds a prefill message

We previously used to disable tool calls by simply removing tool definitions, but this would cause errors with some providers. This implementation uses the supported method appropriate for each provider while providing a fallback for Bedrock.

Co-authored-by: Natalie Tay <natalie.tay@gmail.com>

* remove stray puts

* cleaner chain breaker for last tool call (works in thinking)

remove unused code

* improve test

---------

Co-authored-by: Natalie Tay <natalie.tay@gmail.com>
2025-03-25 08:06:43 +11:00
Keegan George 50e1bc774a
FIX: unable to click doughnut when no filters (#1213)
This PR fixes an issue where you are unable to click to see the sentiment drill-down when there are no current filters applied. This is due to trying to `JSON.parse()` the filters when there are no filters. This fix ensures there are filters first before trying to parse the JSON.
2025-03-24 10:10:22 -07:00
Régis Hanol 2dd7068b46
DEV: add `guardian` argument to `TopicsFilter` callback (#1206)
To match the updates in discourse/discourse#31908
2025-03-24 10:33:18 +01:00
Joffrey JAFFEUX 7e4f93724d
FIX: bump system prompt limit (#1210)
300 was too low, bumped it to 100_000
2025-03-24 08:47:35 +11:00
Isaac Janzen 95160c80e3
FIX: Remove incorrect full-page-search app event (#1209)
This appEvent is not firing on click, but instead on `resetAiResults`. This action is fired many times during page load.
2025-03-21 14:13:22 -05:00
Roman Rizzi 2a8be6e2d7
REFACTOR: Migrate Personas' form to FormKit (#1178)
* REFACTOR: Migrate Personas' form to FormKit

We re-arranged fields into sections so we can better differentiate which options are specific to the AI bot.

* few form-kit improvements

https://github.com/discourse/discourse/pull/31934

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-03-21 14:46:33 -03:00
Rafael dos Santos Silva 0e2dd7378f
DEV: Support for extra model params in LLM completions (#1208)
This will be useful to start experiment with non-standard features like
structured outputs.
2025-03-21 13:49:23 -03:00
Alan Guo Xiang Tan 01eced74a3
FIX: Ensure that we shutdown thread pool (#1207) 2025-03-21 11:08:36 +08:00
Joffrey JAFFEUX 451f7662b2
FIX: prevents fields in Object to re-render (#1205) 2025-03-20 08:32:37 +01:00
Joffrey JAFFEUX 75a1ade441
DEV: supports for form-kit changes (#1203)
form.Object and form.Collection have been changed. Most importantly formObject doesnt yield name but data. It's not your responsibility to build an array of fields.
2025-03-19 15:01:14 +01:00
Discourse Translator Bot de8624416a
Update translations (#1202) 2025-03-18 15:08:26 +01:00
Sam b6483e416d
Revert "DEV: Convert tool editor to form kit (#1135)" (#1201)
This reverts commit 107f14456b.

enum was not handled, so reverting for now
2025-03-18 18:07:04 +11:00
Natalie Tay 5bf61ef9e1
DEV: Support multiple tests per eval and followups per test (#1199)
See https://github.com/discourse/discourse-ai-evals/pull/9 for format of prompts
2025-03-18 11:42:05 +08:00
Keegan George 107f14456b
DEV: Convert tool editor to form kit (#1135)
* DEV: Make tool presets a dropdown

* DEV: Select tool presets via DMenu instead

* WIP

* WIP: Add parameter types, uploader, script, etc.

* WIP

* updates

* fix lint

* FIX: spec

* fixes
2025-03-17 11:38:25 -03:00
Sam 269f169abf
DEV: add API to get topic info from a custom tool (#1197)
Previously we could only get post info
2025-03-17 18:47:23 +11:00
Jarek Radosz 7d7c169afa
DEV: Update linting (#1194) 2025-03-17 15:14:53 +11:00
Sam 9211b211f5
FEATURE: silent triage using ai persona (#1193)
This allows for a new mode in persona triage where nothing is posted on topics.

This allows people to perform all triage actions using tools

Additionally introduces new APIs to create chat messages from tools which can be useful in certain moderation scenarios

Co-authored-by: Natalie Tay <natalie.tay@gmail.com>

* remove TODO code

---------

Co-authored-by: Natalie Tay <natalie.tay@gmail.com>
2025-03-17 15:14:09 +11:00
Kris 24e6aa52bb
UX: try AI search to side on large screens (#1196) 2025-03-14 14:11:02 -04:00
Keegan George 48fff48aa2
FIX: failing image caption spec (#1195) 2025-03-14 10:19:04 -07:00
Kris bd40076dc1
FIX: need to create model when testing new embedding (#1192) 2025-03-14 13:11:44 -04:00
Natalie Tay 3533cd1acc
DEV: Allow prompt-type evals to take in several prompts and messages (#1190)
* DEV: Allow prompt-type evals to take in several prompts and messages

* ❄️
2025-03-14 15:46:22 +11:00
Kris 51ca942d7d
REFACTOR: update embeddings to formkit (#1188) 2025-03-13 11:27:38 -04:00
Jarek Radosz ec8018333e
DEV: Update linting (#1191) 2025-03-13 13:25:38 +00:00
Keegan George 6aaf8a0619
DEV: Use existing topic embeddings when suggesting tags/categories on edit (#1189)
When editing a topic (instead of creating one) and using the
tag/category suggestion buttons. We want to use existing topic
embeddings instead of creating new ones.
2025-03-12 18:52:07 -07:00
Penar Musaraj ac29d3080f
DEV: Fix SCSS linting issue (#1187) 2025-03-12 13:25:17 -04:00
Sam 65503a5038
FIX: various issues with llm and triage management (#1186)
- Fix search API to only include column_names when present to make the API less confusing
- Ensure correct LLM is used in PMs by tracking and preferring the last bot user
- Fix persona_id conversion from string to integer in custom fields
- Add missing test for PM triage with no replies - ensure we don't try to auto title topic 
- Ensure bot users are properly added to PMs
- Make title setting optional when replying to posts
- Add ability to control stream_reply behavior

These changes improve reliability and fix edge cases in bot interactions,
particularly in private messages with multiple LLMs and while triaging posts using personas
2025-03-12 18:32:02 +11:00
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