Commit Graph

281 Commits

Author SHA1 Message Date
Roman Rizzi 1588ab99a6
FIX: ChatChannel no longer inherits from RestModel. (#292)
Trying to hydrate using the store will fail. We need to use the model create function instead.
2023-11-13 14:45:20 -03:00
Roman Rizzi 244a338558
UX: Graph surprise next to joy in post_emotion chart (#291) 2023-11-10 14:41:50 -03:00
Sam a4f419f54f
FEATURE: basic infrastructure for custom personas (#288)
- New AiPersona model which can store custom personas
- Persona are restricted via group security
- They can contain custom system messages
- They can support a list of commands optionally

To avoid expensive DB calls in the serializer a Multisite friendly Hash was introduced (which can be expired on transaction commit)
2023-11-10 11:39:49 +11:00
Roman Rizzi d0198c5c5b
FIX: Changes to the sentiment reports. (#289)
This PR aims to clarify sentiment reports by replacing averages with a count of posts that have one of their values above a threshold (60), meaning we have some level of confidence they are, in fact, positive or negative.

Same thing happen with post emotions, with the difference that a post can have multiple values above it (30). Additionally, we dropped the "Neutral" axis.

We also reworded the tooltip next to each report title, and added an early return to signal we have no data available instead of displaying an empty chart.
2023-11-09 17:23:25 -03:00
Martin Brennan 0c83963a28
DEV: Fix plugin.rb wording (#287)
This was not a complete sentence before
2023-11-09 11:23:43 +10:00
Roman Rizzi 458e66aef9
FIX: Filter classification type using the correct column (#286) 2023-11-08 14:58:35 -03:00
Roman Rizzi 231cf91cc2
FIX: Don't divide by zero if there is no emotion data for TL group (#285) 2023-11-08 13:05:36 -03:00
Roman Rizzi b172ef11c4
FEATURE: Expose sentiment classifications via the admin dashboard. (#284)
This PR adds new reports for displaying information about post sentiments grouped by date and emotions group by TL.

Depends on discourse/discourse#24274
2023-11-08 10:50:37 -03:00
Martin Brennan 30821badf2
Update plugin.rb metadata (#279)
Co-authored-by: AlexDev <104522507+alexdevlaeminck@users.noreply.github.com>
2023-11-07 15:45:02 -08:00
Ty Correll 3df6cb1ec9
UX: prevent suggestion button from wrapping (#282)
* UX: prevent suggestion button from wrapping

This PR addresses the visual bug where the suggestion button wraps on any screen size.

* UX: edge case screen size

This addition fixes screen size issues at specific screen sizes without affecting larger screen sizes, no media query necessary.
2023-11-04 12:52:51 -05:00
Keegan George f6996a6ef0
DEV: Add wrapping classes and remove `has()` usage (#281) 2023-11-03 11:41:57 -07:00
David Taylor 0902f74af5
DEV: Update linting configs (#280) 2023-11-03 11:30:09 +00:00
Discourse Translator Bot e30082dd20
Update translations (#277) 2023-11-01 12:27:29 -03:00
Sam fc65404896
FEATURE: support topic_id and post_id logging in ai audit log (#274)
This makes it easier to track who is responsible for a completion
in logs

Note: ai helper and summarization are not yet implemented
2023-11-01 08:41:31 +11:00
chapoi c6d5c56033
UX: update border on AI topic helpers (#276)
Followup to e2d9117
2023-10-31 13:53:40 +01:00
Sam 0b62c0fa02
FIX: keep parity of shape for image command (#275)
Function calling will start hallucinating if you reshape results.

Previously we were morphing from:

`{ prompts: ["prompt 1", "prompt 2"] }`

to

`{ prompts: { prompt: "prompt 1", seed: 222}, { ... `

This meant that over a few call sequences function_call starts hallucinating an incorrect shape.

This change grounds us even on GPT-3.5
2023-10-31 19:12:25 +11:00
Rafael dos Santos Silva 6f708726e4
PERF: Better chat thread content format for LLM (#273) 2023-10-30 19:57:46 -03:00
Rafael dos Santos Silva cbfd8507b1
FIX: Update bedrock endpoint (#272)
* FIX: Update bedrock endpoint

AWS updated their endpoints per https://docs.aws.amazon.com/general/latest/gr/bedrock.html

* lint
2023-10-30 19:27:50 -03:00
Rafael dos Santos Silva 0c9e18799c
FIX: unexpected return in aihelper entry_point (#271) 2023-10-30 13:32:56 -03:00
Rafael dos Santos Silva 3c55ea8fc0
FEATURE: Automatic Chat Thread titles (#269)
* FEATURE: Automatic Chat Thread titles

* do not gen title for empty threads

* make it default disabled for now
2023-10-30 11:56:33 -03:00
Sam b06380d9fa
FIX: avoid semicolons at the end of queries for SQL Helper (#268)
This makes it easier to cut and paste snippets it is producing

Also fine tune the prompt in an attempt to hone gpt 3.5 which is very finicky
2023-10-27 16:21:09 +11:00
Sam 6add06af8f
FEATURE: Make artist more creative (#266)
This allows for 2 big features:

1. Artist can ship up to 4 prompts for image generation
2. Artist can regenerate images cause it is aware of seed

This allows for iteration on images maintaining visual style
2023-10-27 14:48:12 +11:00
Rafael dos Santos Silva 818b20fb6f
FEATURE: Make embeddings turn-key (#261)
To ease the administrative burden of enabling the embeddings model, this change introduces automatic backfill when the setting is enabled. It also moves the topic visit embedding creation to a lower priority queue in sidekiq and adds an option to skip embedding computation and persistence when we match on the digest.
2023-10-26 12:07:37 -03:00
Sam 426e348c8a
FIX: make stable diffusion multi site friendly (#265)
Previous to this change image generation did not work on multisite

There was a background thread generating the images and it was
getting site settings from the default site in the cluster

This also removes referer header which is not needed
2023-10-25 11:04:16 +11:00
Gerhard Schlager b02be91799
UX: Replace hardcoded string with translation (#264) 2023-10-24 15:54:37 +02:00
Discourse Translator Bot 06c1356d86
Update translations (#263) 2023-10-24 15:53:44 +02:00
Sam 683f8fd4cc
FIX: openai prompt was incorrect for explain (#262)
There is no "Human" role in openai, the blank assistant is not
needed
2023-10-24 16:36:28 +11: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
David Battersby cda5cb6e9c
DEV: update test to use new chat message service (#254)
Update test to use the new chat update message service when editing chat messages.
2023-10-23 17:50:25 +08:00
David Battersby abd3da3383
DEV: skip edit message test until new service added to chat (#259)
Temporarily skip the edit chat message test as we are moving MessageUpdate to a new service in Chat.
2023-10-23 15:30:12 +08: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
Ty Correll 87c591bbc2
UX: unify ai representing icon (#257)
This PR addresses the effort to use one icon representing discourse-ai.

Removed discourse-sparkles from discourse-ai, now included in core ``vendor/assets/svg-icons/discourse-additional.svg``
2023-10-19 17:31:56 -05:00
dependabot[bot] e95b90bc55
Build(deps): Bump @babel/traverse from 7.22.11 to 7.23.2 (#256)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.11 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-19 11:53:55 +02:00
Sam f65e50bd9e
FIX: allow for blank fields in Google results (#255)
Under certain cases, for example:

```
there is this japanese band called kirimi, tell me more about them, try searching 3 times and at least 2 times in japanese before answering.
```

Results come back with blank snippets. This adds protection so this
is allowed and code does not simply blow up.
2023-10-19 14:44:59 +11:00
Rafael dos Santos Silva b9d6179bfc
DEV: Migrations shouldn't rely on the app (#253) 2023-10-16 18:50:37 -03:00
David Taylor 2ed5a40d7d
DEV: Fix .discourse-compatibility typo (#252)
Followup to e21405a600
2023-10-12 11:43:12 +01:00
Alan Guo Xiang Tan e21405a600
DEV: Fix compatibility file (#251)
Why this change?

We should be pinning to 3bced1c6f5 for
Discourse version smaller than `3.2.0.beta2-dev` which is the version
which the incompatibile change was introduced.
2023-10-12 13:50:07 +08:00
Roman Rizzi 38f383a1e0
FIX: Allowlist topic custom field used by AI Bot (#250) 2023-10-11 19:14:19 -03:00
Andrei Prigorshnev 4877394081
DEV: stop using the deprecated cookAsync function (#247)
The cookAsync functions is deprecated since discourse/discourse@fcc9d99.
2023-10-11 20:48:37 +04:00
Discourse Translator Bot 3bced1c6f5
Update translations (#249) 2023-10-11 11:18:14 +02:00
Roman Rizzi 919a87f8d7
FIX: Include OP when building title suggestion prompt. (#248)
When the OP is the only post in the topic, we'll send a prompt without user content to the LLM, and the suggested title will make no sense.
2023-10-10 14:08:08 +11:00
Keegan George 99ee949b33
DEV: Add revert button in diff modal (#246) 2023-10-06 15:17:21 -07:00
Sam 9242da545e
FEATURE: support OpenAI-Organization header (#245)
Per: https://platform.openai.com/docs/api-reference/authentication

There is an organization option which is useful for large orgs

> For users who belong to multiple organizations, you can pass a header to specify which organization is used for an API request. Usage from these API requests will count against the specified organization's subscription quota.
2023-10-06 10:23:18 +11:00
Sam d87adcebea
FEATURE: Claude based scanning and OpenAI retries (#243)
llm_triage supported claude 2 in triage, this implements it

OpenAI rate limits frequently, this introduces some exponential
backoff (3 attempts - 3 seconds, 9 and 27)

Also reduces temp of classifiers so they have consistent behavior
2023-10-05 09:00:45 +11:00
Rafael dos Santos Silva 84cc369552
FEATURE: Bge-large-en embeddings via Cloudflare Workers AI API (#241)
* FEATURE: Bge-large-en embeddings via Cloudflare Workers AI API

* forgot a file

* lint
2023-10-04 13:47:51 -03:00
Discourse Translator Bot 05c256f65b
Update translations (#239) 2023-10-04 09:54:32 +02:00
Rafael dos Santos Silva 4df258ce7d
FIX: Follow fix for missing claude tags in a7adce0 (#242) 2023-10-03 19:56:29 -03:00
Rafael dos Santos Silva a7adce0cf7
FIX: Fallback to whole response when Claude forgets tags (#240) 2023-10-03 15:39:30 -03:00
Sam 0cbf14e343
FEATURE: automation rule for triaging posts using LLM (#236)
The new automation rule can be used to perform llm based classification and categorization of topics. 

You specify a system prompt (which has %%POST%% as an input), if it returns a particular piece of text then we will apply rules such as tagging, hiding, replying or categorizing.

This can be used as a spam filter, a "oops you are in the wrong place" filter and so on. 

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2023-10-03 08:55:30 +11:00
Rafael dos Santos Silva 453928e7bb
FIX: Improvment to embeddings index task (#238) 2023-10-02 16:37:13 -03:00