Commit Graph

138 Commits

Author SHA1 Message Date
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
Sam 3a8d95f6b2
FEATURE: mentionable personas and random picker tool, context limits (#466)
1. Personas are now optionally mentionable, meaning that you can mention them either from public topics or PMs
       - Mentioning from PMs helps "switch" persona mid conversation, meaning if you want to look up sites setting you can invoke the site setting bot, or if you want to generate an image you can invoke dall e
        - Mentioning outside of PMs allows you to inject a bot reply in a topic trivially
     - We also add the support for max_context_posts this allow you to limit the amount of context you feed in, which can help control costs

2. Add support for a "random picker" tool that can be used to pick random numbers 

3. Clean up routing ai_personas -> ai-personas

4. Add Max Context Posts so users can control how much history a persona can consume (this is important for mentionable personas) 

Co-authored-by: Martin Brennan <martin@discourse.org>
2024-02-15 16:37:59 +11:00
Rafael dos Santos Silva 33164a0fec
FIX: Cleanup AI search results when a subsequent search happens (#469) 2024-02-14 11:08:41 +11:00
Roman Rizzi 8bd8280427
FIX: Hide related topics when module is disabled (#461) 2024-02-05 11:45:24 -03:00
Sam a3c827efcc
FEATURE: allow personas to supply top_p and temperature params (#459)
* FEATURE: allow personas to supply top_p and temperature params

Code assistance generally are more focused at a lower temperature
This amends it so SQL Helper runs at 0.2 temperature vs the more
common default across LLMs of 1.0.

Reduced temperature leads to more focused, concise and predictable
answers for the SQL Helper

* fix tests

* This is not perfect, but far better than what we do today

Instead of fishing for

1. Draft sequence
2. Draft body

We skip (2), this means the composer "only" needs 1 http request to
open, we also want to eliminate (1) but it is a bit of a trickier
core change, may figure out how to pull it off (defer it to first draft save)

Value of bot drafts < value of opening bot conversations really fast
2024-02-03 07:09:34 +11:00
Keegan George 944fd6569c
DEV: Add granular control for AI composer helper features (#458) 2024-02-01 14:58:04 -08:00
Keegan George 4c4b418cff
DEV: Not necessary to show modal with errors (#444) 2024-01-26 09:54:43 -08:00
Kris 900df4e8c8
UX: start progress dot animation instantly if it's the only content (#437) 2024-01-22 13:10:51 -05:00
Jarek Radosz 4b4aedb50f
DEV: Use the new controller/period component for the dashboard (#435) 2024-01-19 13:27:33 +01:00
Jarek Radosz 5802cd1a0c
DEV: Fix various typos (#434) 2024-01-19 12:51:26 +01:00
Sam 825f01cfb2
FEATURE: even smoother streaming (#420)
Account properly for function calls, don't stream through <details> blocks
- Rush cooked content back to client
- Wait longer (up to 60 seconds) before giving up on streaming
- Clean up message bus channels so we don't have leftover data
- Make ai streamer much more reusable and much easier to read
- If buffer grows quickly, rush update so you are not artificially waiting
- Refine prompt interface
- Fix lost system message when prompt gets long
2024-01-15 18:51:14 +11:00
Jarek Radosz 6b8a57d957
DEV: Update linting (#423)
Co-authored-by: Keegan George <kgeorge13@gmail.com>
2024-01-13 00:28:06 +01:00
Keegan George 1748ebcb8c
DEV: Prevent HyDE search from being called multiple times (#422) 2024-01-12 11:48:07 -08:00
Sam 8df966e9c5
FEATURE: smooth streaming of AI responses on the client (#413)
This PR introduces 3 things:

1. Fake bot that can be used on local so you can test LLMs, to enable on dev use:

SiteSetting.ai_bot_enabled_chat_bots = "fake"

2. More elegant smooth streaming of progress on LLM completion

This leans on JavaScript to buffer and trickle llm results through. It also amends it so the progress dot is much 
more consistently rendered

3. It fixes the Claude dialect 

Claude needs newlines **exactly** at the right spot, amended so it is happy 

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2024-01-11 15:56:40 +11: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 9d8bbe32a9
FIX: AI Explain copy button not working (#415) 2024-01-10 10:41:48 -08:00
Keegan George 726cffc8af
FIX: New illustrate post suggestions should be auto tracked (#412) 2024-01-10 09:04:10 -08:00
Sam 05f7808057
FEATURE: more elegant progress (#409)
Previous to this change it was very hard to tell if completion was
stuck or not.

This introduces a "dot" that follows the completion and starts
flashing after 5 seconds.
2024-01-09 09:20:28 -03:00
Roman Rizzi 971e03bdf2
FEATURE: AI Bot Gemini support. (#402)
It also corrects the syntax around tool support, which was wrong.

Gemini doesn't want us to include messages about previous tool invocations, so I had to shuffle around some code to send the response it generated from those invocations instead. For this, I created the "multi_turn" context, which bundles all the context involved in the interaction.
2024-01-04 18:15:34 -03:00
Roman Rizzi aa56baad37
FEATURE: Add Mixtral support for AI Bot (#396) 2024-01-04 12:22:43 -03:00
Jan Cernik d9c052f8e7
FIX: 500 error when reviewable has a missing message (#397) 2024-01-03 11:49:47 -03:00
Sam c9b109f9d4
FIX: use async versions of clipboardCopy (#389)
Chrome and Firefox work with standard clipboardCopy, but since
we are making an ajax call Safari fails cause there is too much
delay detected.

To avoid this issue we trade in promises which are acceptable and
work in iOS.
2023-12-29 22:50:10 +11:00
Sam 933784a873
FEATURE: allow easy sharing of bot conversations (#385)
* FEATURE: allow easy sharing of bot conversations

* Lean on new core API i

* Added system spec for copy functionality


* Update assets/javascripts/initializers/ai-bot-replies.js

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>

* discourse later insted of setTimeout

* Update spec/system/ai_bot/share_spec.rb

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>

* feedback from review

just check the whole payload

* remove uneeded code

* fix spec

---------

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2023-12-29 19:47:47 +11:00
Keegan George 5f088b12a7
FIX: Prevent no results label from showing when untrue (#384) 2023-12-27 16:42:13 -08:00
Rafael dos Santos Silva 76f7940b55
Revert "FEATURE: User sentiment on profile summary page (#329)" (#383)
This reverts commit 71c5077228.
2023-12-28 11:01:57 +11:00
Keegan George cb325bb883
UX: Menu placement bottom for AI (#378) 2023-12-22 11:53:41 -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 ba09582d7c
UX: Hide suggest edit button in fast edit when triggering from AI (#364) 2023-12-15 15:19:04 -08:00
Keegan George 19a2949914
UX: Improve focus state of post options item by making full width (#362) 2023-12-15 12:11:29 -08:00
Keegan George d674e47ca4
FEATURE: AI suggestion buttons in `move-to-topic` modal (#360) 2023-12-15 12:11:14 -08:00
Osama Sayegh 831559662e
UX: Automatically detect text direction for AI generated text (#361) 2023-12-15 13:51:47 -03:00
Keegan George 408d9f68eb
FEATURE: Proofread with post AI helper (#359) 2023-12-14 19:30:52 -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
Keegan George 64587967c9
DEV: Cook streamed suggestion (#354) 2023-12-13 12:24:22 -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
Sam a66b1042cc
FEATURE: scale up result count for search depending on model (#346)
We were limiting to 20 results unconditionally cause we had to make
sure search always fit in an 8k context window.

Models such as GPT 3.5 Turbo (16k) and GPT 4 Turbo / Claude 2.1 (over 150k)
allow us to return a lot more results.

This means we have a much richer understanding cause context is far
larger.

This also allows a persona to tweak this number, in some cases admin
may want to be conservative and save on tokens by limiting results

This also tweaks the `limit` param which GPT-4 liked to set to tell
model only to use it when it needs to (and describes default behavior)
2023-12-11 16:54:16 +11:00
Sam 6380ebd829
FEATURE: allow personas to provide command options (#331)
Personas now support providing options for commands.

This PR introduces a single option "base_query" for the SearchCommand. When supplied all searches the persona will perform will also include the pre-supplied filter.

This can allow personas to search a subset of the forum (such as documentation)

This system is extensible we can add options to any command trivially.
2023-12-08 08:42:56 +11:00
Jordan Vidrine 92286ad0c4
UX: Add title to button (#334) 2023-12-05 14:33:10 -06:00
Rafael dos Santos Silva 71c5077228
FEATURE: User sentiment on profile summary page (#329)
* FEATURE: User sentiment on profile summary page

This introduces a new user stat in a user profile summary page.

It will show either neutral/positive/negative according to the dominant
sentiment in the user last interactions.

The user-stat widget is only rendered for staff.


Co-authored-by: Keegan George <kgeorge13@gmail.com>
2023-12-04 18:17:43 -03:00
Sam c8cd38cdda
FIX: command selector behavior stopped working (#330)
When moving ai-command-selector from gjs to js the underlying
behavior changed, this corrects it and adds a test case.
2023-12-02 14:20:26 +11:00
Sam 7f36175ad3
FIX: allow selection of persona when list gets too long (#327) 2023-12-01 08:29:10 +11:00
Jarek Radosz f973fafc33
DEV: Update linting (#326) 2023-11-29 23:01:48 +01:00
Kris 0b9947771c
FIX: adjust tag composer input to avoid wrapping (#324) 2023-11-28 17:38:29 -05:00
Keegan George 02f7b368a1
FIX: Too many requests from single search (#318) 2023-11-27 17:51:42 -08:00
Keegan George c7665e891b
A11Y: Add title attribute to sparkles icon for AI search results (#317) 2023-11-27 14:25:33 -08:00
Keegan George d493880c0a
FIX: Incorrect sort order label appearing when it should not (#315) 2023-11-27 17:27:22 -03:00
Sam 5a4598a7b4
FEATURE: Azure OpenAI support for DALL*E 3 (#313)
* FEATURE: Azure OpenAI support for DALL*E 3

Previous to this there was no way to add an inference endpoint for
DALL*E on Azure cause it requires custom URLs

Also:

- On save, when editing a persona it would revert priority and enabled
- More forgiving parsing in command framework for array function calls
- By default generate HD images - they tend to be a bit better
- Improve DALL*E prompt which was getting very annoying and always echoing what it is about to do
- Add a bit of a sleep between retries on image generation
- Fix error handling in image_command
2023-11-27 13:01:05 +11:00