1
0
mirror of synced 2026-08-03 14:26:56 +00:00

52 Commits

Author SHA1 Message Date
Kris 262bd8b145 UX: add filter to features page, update styles (#1471)
* UX: add filter to features page, update styles

* merge fix

* update toggle spec

* test fix
2025-06-30 09:26:53 +10:00
Joffrey JAFFEUX 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 <kgeorge13@gmail.com>
2025-06-19 11:56:00 +02:00
Roman Rizzi 98afd7f8c3 FEATURE: Display features that rely on multiple personas. (#1411)
* FEATURE: Display features that rely on multiple personas.

This change makes the previously hidden feature page visible while displaying features, like the AI helper, which relies on multiple personas.

* Fix system specs
2025-06-09 16:13:09 -03:00
Roman Rizzi c885e5697f review feedback 2025-06-04 14:23:00 -03:00
Kris fa51e9d948 REFACTOR: update AI conversation sidebar to use sidebar sections for date grouping (#1389) 2025-06-03 09:40:52 -05:00
Sam 3800728d52 FIX: clear uploads after successfully posting new PM (#1307)
This PR addresses a bug where uploads weren't being cleared after successfully posting a new private message in the AI bot conversations interface. Here's what the changes do:

## Main Fix:
- Makes the `prepareAndSubmitToBot()` method async and adds proper error handling
- Adds `this.uploads.clear()` after successful submission to clear all uploads
- Adds a test to verify that the "New Question" button properly resets the UI with no uploads

## Additional Improvements:
1. **Dynamic Character Length Validation**:
   - Uses `siteSettings.min_personal_message_post_length` instead of hardcoded 10 characters
   - Updates the error message to show the dynamic character count
   - Adds proper pluralization in the localization file for the error message

2. **Bug Fixes**:
   - Adds null checks with optional chaining (`link?.topic?.id`) in the sidebar code to prevent potential errors

3. **Code Organization**:
   - Moves error handling from the service to the controller for better separation of concerns
2025-05-02 13:46:22 +10:00
Mark VanLandingham 1e32416eaa UX: Empty state for AI conversations sidebar & btn changes (#1297)
This commit adds an empty state when the user doesn't have any PM history. It ALSO retains the new conversation button in the sidebar so it no longer jumps. The button is disabled, icon, and text are all updated.
2025-04-30 11:33:41 -05:00
Mark VanLandingham 06ab446e47 UX: Adjust bot conversation header and sidebar on hamburger mode (#1295)
Context in dev conversation -- in hamburger mode we don't need the robot icon to swap to shuffle, AND we don't need back to forum link.
2025-04-29 10:10:44 -05:00
Isaac Janzen cd0cfc0bfc DEV: Group PMs by date (#1287)
# Preview

https://github.com/user-attachments/assets/3fe3ac8f-c938-4df4-9afe-11980046944d

# Details

- Group pms by `last_posted_at`. In this first iteration we are group by `7 days`, `30 days`, then by month beyond that. 
- I inject a sidebar section link with the relative (last_posted_at) date and then update a tracked value to ensure we don't do it again. Then for each month beyond the first 30days, I add a value to the `loadedMonthLabels` set and we reference that (plus the year) to see if we need to load a new month label.
- I took the creative liberty to remove the `Conversations` section label - this had no purpose
- I hid the _collapse all sidebar sections_ carrot. This had no purpose. 
- Swap `BasicTopicSerializer` to `ListableTopicSerializer` to get access to `last_posted_at`
2025-04-25 13:20:18 -05:00
Mark VanLandingham 797d727a20 UX: Bring back New Conversation button on mobile sidebar (#1283) 2025-04-24 13:47:11 -05:00
Mark VanLandingham b7b9179bc8 FEATURE: Allow for persona & llm selection in bot conversations page (#1276) 2025-04-24 11:17:24 -05:00
Mark VanLandingham 86f82ea4d3 FIX: Do not re-render conversations sidebar on navigation (#1274) 2025-04-23 15:37:15 +10: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 5fec8fe79e.
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
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
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
Kris 8203bdfbc9 UX: move topic summary from DMenu to DModal (#992)
Co-authored-by: Keegan George <kgeorge13@gmail.com>
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
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 9cd14b0003 DEV: Move composer AI helper to toolbar (#796)
Previously we had moved the AI helper from the options menu to a selection menu that appears when selecting text in the composer. This had the benefit of making the AI helper a more discoverable feature. Now that some time has passed and the AI helper is more recognized, we will be moving it back to the composer toolbar.

This is better because:
- It consistent with other behavior and ways of accessing tools in the composer
- It has an improved mobile experience
- It reduces unnecessary code and keeps things easier to migrate when we have composer V2.
- It allows for easily triggering AI helper for all content by clicking the button instead of having to select everything.
2024-09-13 11:59:30 -07:00
Keegan George bfe3b1c3b8 FIX: Modals in composer helper menu not working (#755) 2024-08-16 10:08:58 -07:00
Keegan George 23b88537d9 FIX: Prevent AI caption setting from showing unless all criteria is met (#753) 2024-08-14 10:17:36 -07:00
Keegan George 1254d7c7d0 REFACTOR: AI Composer Helper Menu (#715) 2024-08-06 10:57:39 -07:00
Keegan George 08355ea5d8 FEATURE: Show post helper as bottom modal on mobile (#704) 2024-07-10 11:01:05 -07:00
Sam b863ddc94b FEATURE: custom user defined tools (#677)
Introduces custom AI tools functionality. 

1. Why it was added:
   The PR adds the ability to create, manage, and use custom AI tools within the Discourse AI system. This feature allows for more flexibility and extensibility in the AI capabilities of the platform.

2. What it does:
   - Introduces a new `AiTool` model for storing custom AI tools
   - Adds CRUD (Create, Read, Update, Delete) operations for AI tools
   - Implements a tool runner system for executing custom tool scripts
   - Integrates custom tools with existing AI personas
   - Provides a user interface for managing custom tools in the admin panel

3. Possible use cases:
   - Creating custom tools for specific tasks or integrations (stock quotes, currency conversion etc...)
   - Allowing administrators to add new functionalities to AI assistants without modifying core code
   - Implementing domain-specific tools for particular communities or industries

4. Code structure:
   The PR introduces several new files and modifies existing ones:

   a. Models:
      - `app/models/ai_tool.rb`: Defines the AiTool model
      - `app/serializers/ai_custom_tool_serializer.rb`: Serializer for AI tools

   b. Controllers:
      - `app/controllers/discourse_ai/admin/ai_tools_controller.rb`: Handles CRUD operations for AI tools

   c. Views and Components:
      - New Ember.js components for tool management in the admin interface
      - Updates to existing AI persona management components to support custom tools 

   d. Core functionality:
      - `lib/ai_bot/tool_runner.rb`: Implements the custom tool execution system
      - `lib/ai_bot/tools/custom.rb`: Defines the custom tool class

   e. Routes and configurations:
      - Updates to route configurations to include new AI tool management pages

   f. Migrations:
      - `db/migrate/20240618080148_create_ai_tools.rb`: Creates the ai_tools table

   g. Tests:
      - New test files for AI tool functionality and integration

The PR integrates the custom tools system with the existing AI persona framework, allowing personas to use both built-in and custom tools. It also includes safety measures such as timeouts and HTTP request limits to prevent misuse of custom tools.

Overall, this PR significantly enhances the flexibility and extensibility of the Discourse AI system by allowing administrators to create and manage custom AI tools tailored to their specific needs.

Co-authored-by: Martin Brennan <martin@discourse.org>
2024-06-27 17:27:40 +10:00
Keegan George a1c649965f FEATURE: Auto image captions (#637) 2024-05-27 10:49:24 -07:00
Keegan George 8875830f6a FEATURE: Insert footnote from explained result (#591) 2024-05-03 11:53:17 -07:00
Keegan George cb4d438506 UX: Highlight AI post helper selection (#520) 2024-04-04 11:35:01 -07:00
Keegan George 740731ab53 FIX: Image caption feature should respect composer AI helper groups (#522) 2024-03-11 15:35:20 -07:00
Kris b72ee805b6 DEV: update caption test for core interaction change (#503) 2024-03-01 14:58:33 -05:00
Keegan George 6a30b06a55 DEV: Cancel popup should abort request (#497) 2024-02-28 13:32:45 -08:00
Keegan George 2c7d34ff1f DEV: Image caption system specs (#487) 2024-02-26 12:22:09 -08:00
Keegan George d674e47ca4 FEATURE: AI suggestion buttons in move-to-topic modal (#360) 2023-12-15 12:11:14 -08:00
Keegan George 6aaf1f002e FEATURE: Add streaming to post AI helper's explain option (#344)
Co-authored-by: Rafael dos Santos Silva <xfalcox@gmail.com>
Co-authored-by: Roman Rizzi <roman@discourse.org>
2023-12-12 09:28:39 -08:00
David Taylor e1a7d07a91 DEV: Update tests for core change (#293)
https://github.com/discourse/discourse/pull/23967
2023-11-15 09:23:27 +00:00
Rafael dos Santos Silva 0e5764617a FEATURE: AI helper on posts (#244)
Adds an AI Helper function when selecting text while viewing a topic.

---------

Co-authored-by: Keegan George <kgeorge13@gmail.com>
Co-authored-by: Roman Rizzi <roman@discourse.org>
2023-10-23 11:41:36 -03:00
Keegan George 237e9478df UX: Use disable/enable state for custom prompt button (#233) 2023-09-27 14:27:16 -07:00
Keegan George 2e5a39360a FEATURE: Create custom prompts with composer AI helper (#214)
* DEV: Add icon support

* DEV: Add basic setup for custom prompt menu

* FEATURE: custom prompt backend

* fix custom prompt param check

* fix custom prompt replace

* WIP

* fix custom prompt usage

* fixes

* DEV: Update front-end

* DEV: No more custom prompt state

* DEV: Add specs

* FIX: Title/Category/Tag suggestions

Suggestion dropdowns broke because it `messages_with_user_input(user_input)` expects a hash now.

* DEV: Apply syntax tree

* DEV: Restrict custom prompts to configured groups

* oops

* fix tests

* lint

* I love tests

* lint is cool tho

---------

Co-authored-by: Rafael dos Santos Silva <xfalcox@gmail.com>
2023-09-25 15:12:54 -03:00
Keegan George abe96d5533 DEV: Strip out old modal based AI helper (#209) 2023-09-06 13:28:47 -07:00
Keegan George 0733ff7e67 UX: Show suggestion buttons only if sufficient content is present (#204) 2023-09-06 12:20:08 -07:00
Keegan George 8d674c451a FIX: Flaky spec in AI Helper modal (#208) 2023-09-06 10:15:11 -07:00
Keegan George ae0238c616 FIX: Flaky spec (#197) 2023-09-05 09:56:12 -07:00
Rafael dos Santos Silva 43e485cbd9 FEATURE: Additional AI suggestion options (#176) 2023-09-01 17:10:58 -07:00
Keegan George 7457feced8 FEATURE: Show suggested title prompt in new location (#171) 2023-08-29 09:45:53 -07:00
Keegan George 7790313b1b DEV: Add review menu state (#159) 2023-08-24 17:49:24 -07:00
Keegan George 65c6b5e16c DEV: Add keybindings (#157)
- Ability to Esc to close context menu
- Ability to Ctrl/Cmd + Z to undo results
2023-08-24 08:35:53 +10:00
Keegan George 6df850d473 FEATURE: AI Helper Context Menu (#148) 2023-08-23 10:35:40 -07:00
Roman Rizzi 3364fec425 DEV: Remove the summarization feature (#83)
* DEV: Remove the summarization feature

Instead, we'll register summarization implementations for OpenAI, Anthropic, and Discourse AI using the API defined in discourse/discourse#21813.

Core and chat will implement features on top of these implementations instead of this plugin extending them.

* Register instances that contain the model, requiring less site settings
2023-06-13 14:32:26 -03:00
Roman Rizzi 38e007a3a5 FEATURE: Topic summarization (#41)
* FEATURE: Topic summarization

Summarize topics using the TopicView's "summary" filter. The UI is similar to what we do for chat, but we don't allow the user to select a timeframe.


Co-authored-by: Rafael dos Santos Silva <xfalcox@gmail.com>
2023-04-19 17:57:31 -03:00