From 284aa7377236775bc6518028a7489e071687dbcf Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Thu, 30 May 2024 03:58:26 -0600 Subject: [PATCH] [v11.0.x] DashboardAI: Reformat prompts to have a single system prompt (#88477) --- .../GenAI/GenAIDashDescriptionButton.tsx | 2 +- .../components/GenAI/GenAIDashTitleButton.tsx | 2 +- .../GenAI/GenAIPanelDescriptionButton.tsx | 13 ++++--------- .../components/GenAI/GenAIPanelTitleButton.tsx | 15 +++++---------- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/public/app/features/dashboard/components/GenAI/GenAIDashDescriptionButton.tsx b/public/app/features/dashboard/components/GenAI/GenAIDashDescriptionButton.tsx index f2df2ef09ea..cc565ea1c8c 100644 --- a/public/app/features/dashboard/components/GenAI/GenAIDashDescriptionButton.tsx +++ b/public/app/features/dashboard/components/GenAI/GenAIDashDescriptionButton.tsx @@ -45,7 +45,7 @@ function getMessages(): Message[] { }, { content: `The title of the dashboard is "${dashboard.title}"\n` + `${panelPrompt}`, - role: Role.system, + role: Role.user, }, ]; } diff --git a/public/app/features/dashboard/components/GenAI/GenAIDashTitleButton.tsx b/public/app/features/dashboard/components/GenAI/GenAIDashTitleButton.tsx index c2991f075b8..78c3c4ef755 100644 --- a/public/app/features/dashboard/components/GenAI/GenAIDashTitleButton.tsx +++ b/public/app/features/dashboard/components/GenAI/GenAIDashTitleButton.tsx @@ -44,7 +44,7 @@ function getMessages(): Message[] { }, { content: `The panels in the dashboard are: ${getDashboardPanelPrompt(dashboard)}`, - role: Role.system, + role: Role.user, }, ]; } diff --git a/public/app/features/dashboard/components/GenAI/GenAIPanelDescriptionButton.tsx b/public/app/features/dashboard/components/GenAI/GenAIPanelDescriptionButton.tsx index e82194306fe..9739387ba28 100644 --- a/public/app/features/dashboard/components/GenAI/GenAIPanelDescriptionButton.tsx +++ b/public/app/features/dashboard/components/GenAI/GenAIPanelDescriptionButton.tsx @@ -45,15 +45,10 @@ function getMessages(panel: Panel): Message[] { role: Role.system, }, { - content: `The panel is part of a dashboard with the title: ${dashboard.title}`, - role: Role.system, - }, - { - content: `The panel is part of a dashboard with the description: ${dashboard.description}`, - role: Role.system, - }, - { - content: `This is the JSON which defines the panel: ${panelString}`, + content: + `The panel is part of a dashboard with the title: ${dashboard.title}\n` + + `The panel is part of a dashboard with the description: ${dashboard.description}\n` + + `This is the JSON which defines the panel: ${panelString}`, role: Role.user, }, ]; diff --git a/public/app/features/dashboard/components/GenAI/GenAIPanelTitleButton.tsx b/public/app/features/dashboard/components/GenAI/GenAIPanelTitleButton.tsx index 298898450f3..0995952b9e0 100644 --- a/public/app/features/dashboard/components/GenAI/GenAIPanelTitleButton.tsx +++ b/public/app/features/dashboard/components/GenAI/GenAIPanelTitleButton.tsx @@ -39,16 +39,11 @@ function getMessages(panel: Panel, dashboard: Dashboard): Message[] { role: Role.system, }, { - content: `The panel is part of a dashboard with the title: ${dashboard.title}`, - role: Role.system, - }, - { - content: `The panel is part of a dashboard with the description: ${dashboard.description}`, - role: Role.system, - }, - { - content: `Use this JSON object which defines the panel: ${panelString}`, - role: Role.system, + content: + `The panel is part of a dashboard with the title: ${dashboard.title}\n` + + `The panel is part of a dashboard with the description: ${dashboard.description}\n` + + `Use this JSON object which defines the panel: ${panelString}`, + role: Role.user, }, ]; }