Commit Graph
50 Commits
Author SHA1 Message Date
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
David Taylor 1a10680818 DEV: Replace DSection with body-class helper (#924) 2024-11-20 14:11:15 +00: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 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
chapoiandKeegan George 10dae65740 UX: style & position AI helper in composer (#758)
Co-authored-by: Keegan George <[email protected]>
2024-08-21 11:01:03 -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
Keegan George eab2f74b58 DEV: Use site locale for composer helper translations (#698) 2024-07-04 08:23:37 -07:00
Keegan George fc6b937df7 FIX: Revert length issue (#556) 2024-04-04 10:28:17 -07:00
Sam 74c6725c75 FIX: avoid error when attempting to show ai helper to anon (#549)
Also adds an extra guard around ai helper context positioning.
2024-03-28 12:24:00 +11:00
Keegan George cee1b3d275 FIX: Backspace in composer custom prompt closes menu (#505) 2024-03-04 13:33:31 -08:00
Krzysztof Kotlarek dd6b073fc3 DEV: Make more group-based settings client: false (#474)
Affects the following settings:

ai_toxicity_groups_bypass
ai_helper_allowed_groups
ai_helper_custom_prompts_allowed_groups
post_ai_helper_allowed_groups

This turns off client: true for these group-based settings,
because there is no guarantee that the current user gets all
their group memberships serialized to the client. Better to check
server-side first.
2024-02-19 13:26:24 +11:00
Keegan George d66915ecc1 DEV: Make prompts available on CurrentUserSerializer (#472) 2024-02-16 10:57:14 -08:00
Keegan George 944fd6569c DEV: Add granular control for AI composer helper features (#458) 2024-02-01 14:58:04 -08:00
Jarek Radosz 5802cd1a0c DEV: Fix various typos (#434) 2024-01-19 12:51:26 +01:00
Jarek RadoszandKeegan George 6b8a57d957 DEV: Update linting (#423)
Co-authored-by: Keegan George <[email protected]>
2024-01-13 00:28:06 +01:00
Keegan George 5c9b570562 FIX: Revert AI action not working in Firefox (#418)
* FIX: Revert AI action not working in Firefox

* Make it pretty 💄
2024-01-11 11:43:39 +11:00
Keegan George 726cffc8af FIX: New illustrate post suggestions should be auto tracked (#412) 2024-01-10 09:04:10 -08:00
Keegan George 8feb3ad4db FIX: Context menu should not appear if selected text is deleted (#374) 2023-12-20 10:50:17 -08:00
Keegan George ea116f91fc FIX: Undo issue (#372) 2023-12-20 10:46:22 -08:00
Keegan George 7b4710d5c9 FEATURE: Generate post illustrations (#367) 2023-12-19 11:17:34 -08:00
Keegan George 74a7ac4a3d FEATURE: Add custom prompts to post helper options (#355)
* FEATURE: Add custom prompts to post helper options

* 💄Make pretty

* 💄Make pretty!
2023-12-14 13:47:20 -03:00
6aaf1f002e FEATURE: Add streaming to post AI helper's explain option (#344)
Co-authored-by: Rafael dos Santos Silva <[email protected]>
Co-authored-by: Roman Rizzi <[email protected]>
2023-12-12 09:28:39 -08:00
David Taylor 0902f74af5 DEV: Update linting configs (#280) 2023-11-03 11:30:09 +00:00
Gerhard Schlager b02be91799 UX: Replace hardcoded string with translation (#264) 2023-10-24 15:54:37 +02:00
0e5764617a FEATURE: AI helper on posts (#244)
Adds an AI Helper function when selecting text while viewing a topic.

---------

Co-authored-by: Keegan George <[email protected]>
Co-authored-by: Roman Rizzi <[email protected]>
2023-10-23 11:41:36 -03:00
Sam 1500308437 FEATURE: defer creation of bot users (#258)
Also fixes it so users without bot in header can send it messages.

Previous to this change we would seed all bots with database seeds.

This lead to lots of confusion for people who do not enable ai bot.

Instead:

1. We do not seed any bots **until** user enables the ai_bot_enabled setting
2. If it is disabled we will
  a. If no messages were created by bot - delete it
  b. Otherwise we will deactivate account
2023-10-23 17:00:58 +11:00
Keegan George 99ee949b33 DEV: Add revert button in diff modal (#246) 2023-10-06 15:17:21 -07:00
Keegan George 237e9478df UX: Use disable/enable state for custom prompt button (#233) 2023-09-27 14:27:16 -07:00
Keegan George 0c50d7d553 DEV: Improvements to context menu (#232) 2023-09-27 11:39:51 -07:00
Keegan GeorgeandRafael dos Santos Silva 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 <[email protected]>
2023-09-25 15:12:54 -03:00
Keegan George d35c8d5eca FIX: Conditionally render AI suggestion buttons (#225) 2023-09-13 14:18:48 -07:00
Keegan George cf6a6ed9b8 FIX: AI Helper UX bugs (#223) 2023-09-13 09:53:19 -07:00
Keegan George 6295b16678 FEATURE: Add cancel button to loading context menu (#213) 2023-09-07 13:50:56 -07:00
Keegan George 3a00c38fc5 UX: Change AI Helper toggle icon to sparkles (#201) 2023-09-05 13:21:05 -07:00
Sam db19e37748 FEATURE: add initial support for personas (#172)
This splits out a bunch of code that used to live inside bots
into a dedicated concept called a Persona.

This allows us to start playing with multiple personas for the bot

Ships with:

artist - for making images
sql helper - for helping with data explorer
general - for everything and anything
 
Also includes a few fixes that make the generic LLM function implementation  more robust
2023-08-30 16:15:03 +10:00
Keegan George 494964c51d DEV: Dynamically set popper placement (#174) 2023-08-29 11:19:25 -07:00
Keegan George 7457feced8 FEATURE: Show suggested title prompt in new location (#171) 2023-08-29 09:45:53 -07:00
Keegan George fba419f864 UX: Clicking outside editor should close context menu (#170) 2023-08-28 15:08:51 -07:00
Keegan George 2c50791f26 UX: Prevent context menu overflow outside of container (#168) 2023-08-28 13:31:21 -07:00
Keegan George b470692409 DEV: Preload prompt list on component initialization (#165) 2023-08-28 12:22:44 -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 78558b9cf5 DEV: Remove context menu timeout (#156) 2023-08-23 15:12:07 -07:00
Keegan George 3cf316fb62 FIX: Context menu not appearing in Firefox (#154) 2023-08-23 14:20:31 -07:00
Keegan George 45b7b57726 FIX: Pages with small composers breaking (#155) 2023-08-23 14:20:14 -07:00
Keegan George 1289ae1c57 FIX: Add check for PMs before showing AI helper context menu (#153) 2023-08-23 11:24:51 -07:00
Keegan George 4a00b7eb0e FIX: Show AI helper only if in allowed groups (#152) 2023-08-23 11:06:04 -07:00
Keegan George 6df850d473 FEATURE: AI Helper Context Menu (#148) 2023-08-23 10:35:40 -07:00
Sam 3e46250f3f UX: Adjust bot warning so it looks better (#141)
This moves the bot warning from `composer-after-composer-editor` to
`after-d-editor` (with a minor adjustment for outlet args to match new name)
2023-08-17 14:43:14 +10:00