Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Conversation

@jjaffeux
Copy link
Contributor

@jjaffeux jjaffeux commented Jan 29, 2025

This also converts the quota editor, and the quota modal.

The most debatable change is that I moved tooltips into descriptions, we can change this in the future if that's a significant issue.

Screenshot 2025-01-29 at 19 25 31 Screenshot 2025-01-29 at 19 27 18 Screenshot 2025-01-29 at 19 27 14 Screenshot 2025-01-29 at 19 27 22

async testConfig() {
return await ajax(`/admin/plugins/discourse-ai/ai-llms/test.json`, {
data: { ai_llm: this.createProperties() },
async testConfig(llmConfig) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I allowed to pass an arbitrary llmConfig object to test

@@ -1,178 +0,0 @@
import Component from "@glimmer/component";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved all of this in the form, I could split it in multiple components, but there was not much value to it. It's implemented using the collection from form kit: https://meta.discourse.org/t/discourse-toolkit-to-render-forms/326439?silent=true

import AiLlmEditorForm from "./ai-llm-editor-form";

export default class AiLlmEditor extends Component {
constructor() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved all of this in the form as it's technically the form data

grid-template-columns: repeat(auto-fill, minmax(16em, 1fr));
gap: 1em 2em;
margin-top: 1em;
border-top: 3px solid var(--primary-low); // matches tbody border
Copy link
Contributor Author

@jjaffeux jjaffeux Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a super weird behavior in my editor with this comment not sure why, removed it for now

expect(llm.user_id).not_to be_nil
end

context "with quotas" do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added simple tests for quotas

Copy link
Member

@keegangeorge keegangeorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One small suggestion

Comment on lines -111 to -112
openAddQuotaModal() {
this.modalIsVisible = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a particular reason why this is being switched to using the modal service instead of the declarative technique in the template? I believe declarative technique is preferred when possible (ref).

Can we mut a tracked property for addItemToCollection that gets passed as an arg to the modal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would it be preferred here? It's a lot more code to be declarative here, you even have to use your own tracked property.

Copy link
Contributor

@martin-brennan martin-brennan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing 👏

@SamSaffron
Copy link
Member

sorry my change just created a merge conflict @jjaffeux

@jjaffeux
Copy link
Contributor Author

jjaffeux commented Feb 4, 2025

sorry my change just created a merge conflict @jjaffeux

no worries, im merging today, I had fixes to do in core which I just merged

jjaffeux and others added 8 commits February 4, 2025 10:38
This also converts the quota editor, and the quota modal.

The most debatable change is that I moved tooltips into descriptions, we can change this in the future if that's a significant issue.
@jjaffeux jjaffeux force-pushed the llm-config-form-kit branch from 3c4b04b to 6f38591 Compare February 4, 2025 10:15
@jjaffeux jjaffeux merged commit 40e996b into main Feb 4, 2025
6 checks passed
@jjaffeux jjaffeux deleted the llm-config-form-kit branch February 4, 2025 10:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants