Skip to content

Commit

Permalink
AAP-21329: Capture relevant model in feedback events (#1131)
Browse files Browse the repository at this point in the history
* AAP-21329: Capture relevant model in feedback events

* Test case added

* Reduced complexity

---------

Co-authored-by: Ganesh Nalawade <[email protected]>
  • Loading branch information
romartin and ganeshrn authored Mar 18, 2024
1 parent aeecbf9 commit 243ebeb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/features/lightspeed/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { getBaseUri } from "./utils/webUtils";
import { ANSIBLE_LIGHTSPEED_API_TIMEOUT } from "../../definitions/constants";
import { UserAction } from "../../definitions/lightspeed";
import { retrieveError } from "./handleApiError";
import { lightSpeedManager } from "../../extension";

export class LightSpeedAPI {
private axiosInstance: AxiosInstance | undefined;
Expand Down Expand Up @@ -176,6 +177,9 @@ export class LightSpeedAPI {
}
const rhUserHasSeat = await this.lightSpeedAuthProvider.rhUserHasSeat();

inputData.model =
lightSpeedManager.settingsManager.settings.lightSpeedService.model;

if (rhUserHasSeat && orgOptOutTelemetry) {
if (inputData.inlineSuggestion) {
delete inputData.inlineSuggestion;
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/lightspeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface FeedbackRequestParams {
sentimentFeedback?: SentimentEvent;
suggestionQualityFeedback?: SuggestionQualityEvent;
issueFeedback?: IssueFeedbackEvent;
model?: string;
}

export interface IDocumentTrackerFields {
Expand Down
16 changes: 16 additions & 0 deletions test/testScripts/lightspeed/testLightSpeedFunctions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ function testFeedbackAPI(): void {
// When an error is found, feedbackRequest() does not return a message
assert.equal(response.message, undefined);
});

it("Verify a sentiment feedback contains the model, if set", async function () {
lightSpeedManager.settingsManager.settings.lightSpeedService.model =
"testModel";
const apiInstance = lightSpeedManager.apiInstance;
const request = {
sentimentFeedback: {
value: 1,
feedback: "Great stuff",
},
model: "",
};
const response = await apiInstance.feedbackRequest(request);
console.log(JSON.stringify(response));
assert.equal(request.model, "testModel");
});
});

after(async function () {
Expand Down

0 comments on commit 243ebeb

Please sign in to comment.