Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions frontend/src/components/app-config/ai-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1168,15 +1168,20 @@ export const AiModelDisplayConfig: React.FC<AiConfigProps> = ({
))}
</Tree>
</div>
<AddModelForm form={form} customModels={customModels} />
<AddModelForm
form={form}
customModels={customModels}
onSubmit={onSubmit}
/>
</SettingGroup>
);
};

export const AddModelForm: React.FC<{
form: UseFormReturn<UserConfig>;
customModels: QualifiedModelId[];
}> = ({ form, customModels }) => {
onSubmit: (values: UserConfig) => void;
}> = ({ form, customModels, onSubmit }) => {
const [isFormOpen, setIsFormOpen] = useState(false);
const [modelAdded, setModelAdded] = useState(false);
const [provider, setProvider] = useState<ProviderId | "custom" | null>(null);
Expand Down Expand Up @@ -1209,6 +1214,7 @@ export const AddModelForm: React.FC<{
);

form.setValue("ai.models.custom_models", [newModel.id, ...customModels]);
onSubmit(form.getValues());
resetForm();

// Show model added message for 2 seconds
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/core/codemirror/language/languages/sql/sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,14 +666,13 @@ function sqlValidationExtension(): Extension {
let lastValidationRequest: string | null = null;

return EditorView.updateListener.of((update) => {
// Only run validation if the document has changed
if (!update.docChanged) {
// Only run validation if the document has changed and editor is focused
if (!update.docChanged || !update.view.hasFocus) {
return;
}

// Only run validation if the SQL mode is set to validate
const sqlMode = getSQLMode();
if (sqlMode !== "validate") {
if (sqlMode === "default") {
return;
}

Expand Down Expand Up @@ -710,7 +709,6 @@ function sqlValidationExtension(): Extension {

try {
const dialect = connectionNameToParserDialect(connectionName);
const sqlMode = getSQLMode();
const result = await validateSQL(
sqlContent,
connectionName,
Expand Down
Loading