178 Commits
Author SHA1 Message Date
Keegan George a4194d3fb2 FIX: AI preferences tab button not appearing unless Helper enabled (#1452)
This update fixes an issue where the AI user preferences tab was not appearing unless `SiteSetting.ai_helper_enabled` was `true`. This is because we previously checked for it's presence when user preferences only had a single setting related to Helper. However, since then, we've also added search discoveries setting there too. As such, we don't want it to depend on Helper. We also sneak in this update a modernization of converting the preferences template from `.hbs` to `.gjs`.
2025-06-20 10:12:08 -07:00
Joffrey JAFFEUXandKeegan George 6a33e5154d DEV: makes ai menu helper a standalone menu (#1434)
The current menu was rendering inside the post text toolbar (on desktop). This is not ideal as the post text toolbar rendering is conditioned on the presence of text selection, when you click a button on the toolbar, by design of the web browsers you will lose your text selection, making all of this super tricky.

This commit makes desktop and mobile behave in the same way by rendering their own menu and capturing the quote state when we render the post text selection toolbar, this allows us to reason a much simpler way about the AI helper.

This commit also removes what appears to be an unused file and corrects which was seemingly copy/paste mistakes.

⚠️ Technical note, this commit is correcting the message bus subscription which amongst other things allows to write specs which are not flaky. However due to the current implementation we have a channel per post, which means we need to serialize on last message bus id per post. 

We have two possible solutions here:
- subscribe at the topic level
- refactor the code to be able to use `MessageBus.last_ids` to be able to grab multiple posts at once instead of having to call `MessageBus.last_id` and done one Redis call per post

---------

Co-authored-by: Keegan George <[email protected]>
2025-06-19 11:56:00 +02:00
Roman Rizzi 0338dbea23 FEATURE: Use different personas to power AI helper features.
You can now edit each AI helper prompt individually through personas, limit access to specific groups, set different LLMs, etc.
2025-06-04 14:23:00 -03:00
Alan Guo Xiang Tan 9f43df0302 FIX: Full page search broken (#1383)
Follow-up to 59d6e2b467
2025-05-30 10:07:48 +08:00
David Taylor 59d6e2b467 DEV: Replace narrowDesktopView logic with viewport API (#1372) 2025-05-30 06:52:39 +10:00
Keegan George e264572597 FIX: Closing AI menu stops post audio from playing (#1369)
## 🔍 Overview
When you have a post with audio being played and you open and close the AI post helper menu, it re-renders the entire post DOM, causing the audio to be interrupted and stop playing.

The reason for this is because we highlight the selected text when opening the AI post helper menu and we replace the entire post back with the original post HTML when closing the menu. This fix ensures that we do not re-render the entire post DOM and instead only remove the highlighted section that was added.

## 🔗 Context
https://meta.discourse.org/t/ai-helper-interrupting-uploaded-mp3-audio-stream/366817?u=keegan
2025-05-26 10:24:06 -07:00
Mark VanLandingham cead887480 FIX: Don't error when navigating from AI Bot topic to regular (#1366)
We were getting an error in this logic causing Ember to fail to render the non-bot-topic that we navigate to.

I believe this is because the getter of participants is re-calculating (due to this.header.topicInfo being updated) before the args to this connector changes. Adding some safe navigation here fixes the issue.
2025-05-23 13:30:08 -05:00
Kris 53905f65ac FEATURE: add participants and invite button to AI conversations (#1354) 2025-05-21 10:27:06 +10:00
Kris 1573e6a694 UX: don't show AI suggestions in composer when inputs are disabled (#1331) 2025-05-09 12:34:53 -04:00
Kris 81a664b3da UX: put full page search discoveries in sidebar (#1289) 2025-04-30 12:01:21 -04:00
Mark VanLandingham b7b9179bc8 FEATURE: Allow for persona & llm selection in bot conversations page (#1276) 2025-04-24 11:17:24 -05: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
Keegan Georgeandawesomerobot 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 <[email protected]>
2025-03-31 08:38:40 -07:00
Jarek Radosz 7d7c169afa DEV: Update linting (#1194) 2025-03-17 15:14:53 +11: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
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
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
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
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
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 RizziandKeegan George 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 <[email protected]>

---------

Co-authored-by: Keegan George <[email protected]>
2025-02-20 14:37:58 -03:00
Kris 3a755ca883 DEV: add summary button wrapper removed from core (#1136) 2025-02-19 12:58:10 -05:00
David Taylor 551f674c43 DEV: Bump dependencies and fix linting (#1115) 2025-02-06 17:42:32 +01:00
Sam cf86d274a0 FEATURE: improve o3-mini support (#1106)
* DEV: raise timeout for reasoning LLMs

* FIX: use id to identify llms, not model_name

model_name is not unique, in the case of reasoning models
you may configure the same llm multiple times using different
reasoning levels.
2025-02-03 08:45:56 +11:00
Kris d5bf9521f0 DEV: add missing class to summarize button (#1093) 2025-01-28 08:49:29 -05:00
SamandKeegan George d07cf51653 FEATURE: llm quotas (#1047)
Adds a comprehensive quota management system for LLM models that allows:

- Setting per-group (applied per user in the group) token and usage limits with configurable durations
- Tracking and enforcing token/usage limits across user groups
- Quota reset periods (hourly, daily, weekly, or custom)
-  Admin UI for managing quotas with real-time updates

This system provides granular control over LLM API usage by allowing admins
to define limits on both total tokens and number of requests per group.
Supports multiple concurrent quotas per model and automatically handles
quota resets.


Co-authored-by: Keegan George <[email protected]>
2025-01-14 15:54:09 +11:00
Mark VanLandingham 327adbde29 UX: Full page search -- always show tooltip & add msg (#1051) 2025-01-08 09:05:30 -06:00
Mark VanLandingham b6cefd10fa DEV: Move semantic search from connector to component (#1048) 2025-01-02 12:32:49 -06:00
Mark VanLandingham 24b107881a FEATURE: Unavailable state for semantic search when sort is not Relevant (#1030)
This commit adds an "unavailable" state for the AI semantic search toggle. Currently the AI toggle disappears when the sort by is anything but Relevance which makes the UI confusing for users looking for AI results. This should help!
2024-12-16 14:30:11 -06:00
Keegan George d6beac48f8 DEV: Improve explain suggestion footnote replacement (#999)
Previously, when clicking add footnote on an explain suggestion it would replace the selected word by finding the first occurrence of the word. This results in issues when there are more than one occurrences of a word in a post. This is not trivial to solve, so this PR instead prevents incorrect text replacements by only allowing the replacement if it's unique. We use the same logic here that we use to determine if something can be fast edited.

In this PR we also update tests for post helper explain suggestions. For a while, we haven't had tests here due to streaming/timing issues, we've been skipping our system specs. In this PR, we add acceptance tests to handle this which gives us improved ability to publish message bus updates in the testing environment so that it can be better tested without issues.
2024-12-04 11:41:34 -08:00
KrisandKeegan George 8203bdfbc9 UX: move topic summary from DMenu to DModal (#992)
Co-authored-by: Keegan George <[email protected]>
2024-12-03 13:30:15 -05:00
Keegan George 6b7d7c1179 REFACTOR: Helper suggestions (#914)
This PR adds some updates to the Helper suggestions to improve it's functionality and modernize some of the codebase.
2024-11-27 12:21:03 -08:00
David Taylor 2900d2c87d DEV: Update linting (#933) 2024-11-20 15:43:28 +01:00
David Taylor 1a10680818 DEV: Replace DSection with body-class helper (#924) 2024-11-20 14:11:15 +00:00
Kris a9afa04329 UX: update gist toggle styles (#926) 2024-11-19 15:33:34 -05:00
David Taylor 6b9c66054c DEV: Update eslint config (#917)
* DEV: Update eslint config

* fixup

* pnpm upgrade
2024-11-19 11:57:40 +01:00
Keegan George f75b13c4fa FIX: results not being reset when appending to query param (#912)
This PR fixes an issue where the AI search results were not being reset when you append your search to an existing query param (typically when you've come from quick search). This is because `handleSearch()` doesn't get called in this situation. So here we explicitly check for query params, trigger a reset and search for those occasions.
2024-11-13 07:19:34 -08:00
Keegan George 644141ff08 FIX: Regenerate summary button still shows cached summary (#903)
This PR fixes an issue where clicking to regenerate a summary was still showing the cached summary. To resolve this we call resetSummary() to reset all the summarization related properties before creating a new request.
2024-11-07 16:01:18 -08:00
Keegan George c421f713a3 DEV: Handle streaming animation within AiSummaryBox (#901)
This PR further decouples the streaming animation by completely handling the streaming animation directly in the `AiSummaryBox` component. Previously, handling the streaming animation by calling methods in the `ai-streamer` API was leading to timing issues making things out-of-sync. This results in some issues such as the last update of streamed text not being shown. Handling streaming directly in the component should simplify things drastically and prevent any issues.
2024-11-07 08:08:32 -08:00
Jarek Radosz fa7ca8bc31 DEV: Use the new more-topics API (#885)
See: https://github.com/discourse/discourse/pull/29143
2024-11-04 17:42:50 +01:00
Kris 05790a6a40 UX: convert AI gist disclosure to a toggle (#878) 2024-10-29 11:59:41 -04:00
Roman Rizzi 37b6461d68 FIX: Make sure that topic gists are displayed ONLY on the hot list. (#873) 2024-10-28 15:15:53 -03:00
Sam 4923837165 FIX: Llm selector / forced tools / search tool (#862)
* FIX: Llm selector / forced tools / search tool


This fixes a few issues:

1. When search was not finding any semantic results we would break the tool
2. Gemin / Anthropic models did not implement forced tools previously despite it being an API option
3. Mechanics around displaying llm selector were not right. If you disabled LLM selector server side persona PM did not work correctly.
4. Disabling native tools for anthropic model moved out of a site setting. This deliberately does not migrate cause this feature is really rare to need now, people who had it set probably did not need it.
5. Updates anthropic model names to latest release

* linting

* fix a couple of tests I missed

* clean up conditional
2024-10-25 06:24:53 +11:00
Kris 72111a10ae UX: add disclosure for topic list gists (#861) 2024-10-23 19:32:22 -04:00
Kris 0aa2789437 UX: switch gist outlet to avoid badges (#855) 2024-10-23 15:10:41 -04:00
Kris 657d103919 UX: adjust gist position, darken unread color (#854) 2024-10-23 13:00:52 -04:00
Keegan George eae7716177 DEV: Improve ai-streamer API (#851)
In preparation for applying the streaming animation elsewhere, we want to better improve the organization of folder structure and methods used in the `ai-streamer`
2024-10-22 10:55:35 -07:00