Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ function buildGridResultsPromise(
const columnNames = getGridColumnNames(gridInstance);
const prompt = `${buildGridSystemPrompt(columnNames)}\n\nUser request: '${text}'`;

gridInstance?.instance.beginCustomLoading('');

return executeAiCommand(prompt, aiIntegration)
.then((parsed) => {
const actions = Array.isArray((parsed as { actions?: ExecuteGridAssistantAction[] })?.actions)
Expand Down Expand Up @@ -213,14 +215,12 @@ async function runCommand(
}

if (target === 'form') {
const { results: formResults, error: formError } = await buildFormResultsPromise(form, formAction, text);
const { results: formResults, error: formError } = await buildFormResultsPromise(form, formAction ?? { type: 'smart_paste' }, text);

return joinSucceededOrThrow(formResults, formError);
}

if (target === 'grid') {
gridInstance?.instance.beginCustomLoading('');

const { results: gridResults, error: gridError } = await buildGridResultsPromise(gridInstance, aiIntegration, text);

return joinSucceededOrThrow(gridResults, gridError);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ async function runCommand(text: string, { form, gridInstance, aiIntegration }: R
}

if (target === 'form') {
const { results, error } = await buildFormResultsPromise(form, formAction, text);
const { results, error } = await buildFormResultsPromise(form, formAction ?? { type: 'smart_paste' }, text);
return joinSucceededOrThrow(results, error);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ async function runCommand(text, { form, gridInstance, aiIntegration }) {
);
}
if (target === 'form') {
const { results, error } = await buildFormResultsPromise(form, formAction, text);
const { results, error } = await buildFormResultsPromise(form, formAction ?? { type: 'smart_paste' }, text);
return joinSucceededOrThrow(results, error);
}
if (target === 'grid') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ function buildGridResultsPromise(
const columnNames = getGridColumnNames(gridInstance);
const prompt = `${buildGridSystemPrompt(columnNames)}\n\nUser request: '${text}'`;

gridInstance?.beginCustomLoading('');

return executeAiCommand(prompt, aiIntegration)
.then((parsed) => {
const actions = Array.isArray((parsed as { actions?: ExecuteGridAssistantAction[] })?.actions)
Expand Down Expand Up @@ -221,8 +223,6 @@ async function runCommand(
}

if (target === 'grid') {
gridInstance?.beginCustomLoading('');

const { results: gridResults, error: gridError } = await buildGridResultsPromise(gridInstance, aiIntegration, text);

return joinSucceededOrThrow(gridResults, gridError);
Expand Down
10 changes: 7 additions & 3 deletions apps/demos/Demos/Chat/PageLevelAIAssistant/jQuery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,8 @@ function buildGridResultsPromise(gridInstance, aiIntegration, text) {
const columnNames = getGridColumnNames(gridInstance);
const prompt = `${buildGridSystemPrompt(columnNames)}\n\nUser request: '${text}'`;

gridInstance?.beginCustomLoading('');

return executeAiCommand(prompt, aiIntegration)
.then((parsed) => {
const actions = Array.isArray(parsed.actions) ? parsed.actions : [];
Expand Down Expand Up @@ -900,14 +902,16 @@ async function runCommand(text, { form, gridInstance, aiIntegration }) {

if (target === 'form') {
const { results: formResults, error: formError } =
await buildFormResultsPromise(form, formAction, text);
await buildFormResultsPromise(
form,
formAction ?? { type: 'smart_paste' },
text,
);

return joinSucceededOrThrow(formResults, formError);
}

if (target === 'grid') {
gridInstance?.beginCustomLoading('');

const { results: gridResults, error: gridError } =
await buildGridResultsPromise(gridInstance, aiIntegration, text);

Expand Down
Loading