Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve response for LWC code generation #112

Open
smo17 opened this issue Dec 5, 2024 · 1 comment
Open

Improve response for LWC code generation #112

smo17 opened this issue Dec 5, 2024 · 1 comment
Labels
enhancement New feature or request Generated Responses Issues/Questions related to responses generated using Einstein GPT

Comments

@smo17
Copy link

smo17 commented Dec 5, 2024

Summary

Prompt : "can you generate an LWC that takes displays a list of last 10 created accounts"

Steps To Reproduce:

Requested to create an LWC component with above mentioned prompt

Expected result

Expected code suggestion to include a lightning-datatable at least as best practice and provide a more modern code logic.

Actual result

But HTML content suggested was simply a for-each list and anchor tag with inline javascript to redirect to account, whereby window.openWebLink function does not even exist.

HTML

<template>
  <div>
    <h1>Recent Accounts</h1>
    <ul>
      <template for:each={accounts} for:item={account}>
        <li>
          <a  class="cg-help-link" onclick="window.openWebLink(this);" data-url="/{account.Id}" *="_blank">{account.Name}</a>
        </li>
      </template>
    </ul>
  </div>
</template>

Apex

public with sharing class AccountController {
  @AuraEnabled(cacheable=true)
  public static List<Account> getRecordList(Decimal limitSize) {
    return [SELECT Id, Name, Phone, Website FROM Account ORDER BY CreatedDate DESC LIMIT :limitSize];
  }
}

JS

import { LightningElement, wire } from 'lwc';
import { getRecordList } from '@salesforce/apex/AccountController.getRecordList';

const fields = ['Id', 'Name', 'Phone', 'Website'];

export default class AccountList extends LightningElement {
  accounts = [];

  connectedCallback() {
    getRecordList({ fields, limit: 10 }).then((records) => {
      this.accounts = records;
    });
  }
}

Additional information

image

Salesforce Extension Version in VS Code: 62.5.1

Salesforce Agenrtforce For Developers Version in VS Code: 1.5.0

OS and version: Windows 11 pro x64 24H2

VS Code version: 1.95.3

@klewis-sfdc klewis-sfdc added the Generated Responses Issues/Questions related to responses generated using Einstein GPT label Dec 9, 2024
@klewis-sfdc
Copy link

Hi @smo17,

Thank you for submitting the issue. We are currently working on improved response quality for LWC related prompts. I am going to make a note to test this scenario against some candidate fixes we have in place, and if this issue is not addressed already then I will make a WI to track this quality issue. Thank you!

@klewis-sfdc klewis-sfdc added the enhancement New feature or request label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Generated Responses Issues/Questions related to responses generated using Einstein GPT
Projects
None yet
Development

No branches or pull requests

2 participants