Skip to content

Commit 2d34464

Browse files
committed
GDB-12346 - replace legacy endpoints and update mappers with new response. Edit test stubs.
GDB-12346 - update payloads and mappers GDB-12346 - update frontend according to latest BE changes in legacy code GDB-12346 - revert mapper variable name GDB-12346 - update test stubs with assistantsInstructions property
1 parent 0a4ab6c commit 2d34464

10 files changed

Lines changed: 41 additions & 38 deletions

File tree

e2e-tests/fixtures/ttyg/agent/get-agent-defaults.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"topP": 1.0,
77
"seed": 0,
88
"repositoryId": "test-repository",
9-
"instructions": {
9+
"assistantsInstructions": {
1010
"systemInstruction": "",
1111
"userInstruction": "If you need to write a SPARQL query, use only the classes and properties provided in the schema and don't invent or guess any. Always try to return human-readable names or labels and not only the IRIs. If SPARQL fails to provide the necessary information you can try another tool too."
1212
},

e2e-tests/fixtures/ttyg/agent/get-agent-list-after-deleted.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"topP": 0.0,
88
"seed": null,
99
"repositoryId": "Not existing repo",
10-
"instructions": {
10+
"assistantsInstructions": {
1111
"systemInstruction": "string\n\nstring",
1212
"userInstruction": "string"
1313
},
@@ -25,7 +25,7 @@
2525
"topP": 1.0,
2626
"seed": null,
2727
"repositoryId": "starwars",
28-
"instructions": {
28+
"assistantsInstructions": {
2929
"systemInstruction": "You are helpful assistant in discovering information regarding diagnostic biomarkers.",
3030
"userInstruction": null
3131
},
@@ -43,7 +43,7 @@
4343
"topP": 1.0,
4444
"seed": null,
4545
"repositoryId": "biomarkers",
46-
"instructions": {
46+
"assistantsInstructions": {
4747
"systemInstruction": "You're a helpful assistant in discovering new diagnostic biomarkers for given diseases. I'll submit a set of publication abstracts discussing given disease and your task is to find in the abstracts any potential new biomarkers which are not yet listed in the appropriate databases. Each abstract is preceded by identifier - its PubMed id called for short PMID. \n\nReturn the set of biomarkers listed one per row, each marker followed by the | and PMID of the respective abstract if was mentioned in.\n\nExample: \nInput: 36418457\t[Amyotrophic lateral sclerosis (ALS) is a genetically and phenotypically heterogeneous disease results in the loss of motor neurons. Mounting information points to involvement of other systems including cognitive impairment. However, neither the valid biomarker for diagnosis nor effective therapeutic intervention is available for ALS. The present study is aimed at identifying potentially genetic biomarker that improves the diagnosis and treatment of ALS patients based on the data of the Gene Expression Omnibus. We retrieved datasets and conducted a weighted gene co-expression network analysis (WGCNA) to identify ALS-related co-expression genes. Functional enrichment analysis was performed to determine the features and pathways of the main modules. We then constructed an ALS-related model using the least absolute shrinkage and selection operator (LASSO) regression analysis and verified the model by the receiver operating characteristic (ROC) curve. Besides we screened the non-preserved gene modules in FTD and ALS-mimic disorders to distinct ALS-related genes from disorders with overlapping genes and features. Altogether, 4198 common genes between datasets with the most variation were analyzed and 16 distinct modules were identified through WGCNA. Blue module had the most correlation with ALS and functionally enriched in pathways of neurodegeneration-multiple diseases', 'amyotrophic lateral sclerosis', and 'endocytosis' KEGG terms. Further, some of other modules related to ALS were enriched in 'autophagy' and 'amyotrophic lateral sclerosis'. The 30 top of hub genes were recruited to a LASSO regression model and 5 genes (BCLAF1, GNA13, ARL6IP5, ARGLU1, and YPEL5) were identified as potentially diagnostic ALS biomarkers with validating of the ROC curve and AUC value.]\n\nYour response: BCLAF1|36418457\nGNA13|36418457\nARL6IP5|36418457\nARGLU1|36418457\nYPEL5|36418457",
4848
"userInstruction": null
4949
},

e2e-tests/fixtures/ttyg/agent/get-agent-list-autocomplete-query.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"temperature": 0.7,
77
"topP": 1.0,
88
"repositoryId": "starwars",
9-
"instructions": {
9+
"assistantsInstructions": {
1010
"systemInstruction": null,
1111
"userInstruction": null
1212
},

e2e-tests/fixtures/ttyg/agent/get-agent-list-new-agent.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"topP": 0.2,
88
"seed": 2,
99
"repositoryId": "starwars",
10-
"instructions": {
10+
"assistantsInstructions": {
1111
"systemInstruction": "",
1212
"userInstruction": ""
1313
},

e2e-tests/fixtures/ttyg/agent/get-agent-list-with-incompatible-agents.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"seed": null,
99
"repositoryId": "starwars",
1010
"compatibility": "INCOMPATIBLE",
11-
"instructions": {
11+
"assistantsInstructions": {
1212
"systemInstruction": "",
1313
"userInstruction": ""
1414
},
@@ -28,7 +28,7 @@
2828
"seed": null,
2929
"repositoryId": "Not existing repo",
3030
"compatibility": "COMPATIBLE",
31-
"instructions": {
31+
"assistantsInstructions": {
3232
"systemInstruction": "string\n\nstring",
3333
"userInstruction": "string"
3434
},
@@ -46,7 +46,7 @@
4646
"topP": 1.0,
4747
"seed": null,
4848
"repositoryId": "starwars",
49-
"instructions": {
49+
"assistantsInstructions": {
5050
"systemInstruction": "You are helpful assistant in discovering information regarding diagnostic biomarkers.",
5151
"userInstruction": null
5252
},
@@ -65,7 +65,7 @@
6565
"topP": 1.0,
6666
"seed": null,
6767
"repositoryId": "biomarkers",
68-
"instructions": {
68+
"assistantsInstructions": {
6969
"systemInstruction": "You're a helpful assistant in discovering new diagnostic biomarkers for given diseases. I'll submit a set of publication abstracts discussing given disease and your task is to find in the abstracts any potential new biomarkers which are not yet listed in the appropriate databases. Each abstract is preceded by identifier - its PubMed id called for short PMID. \n\nReturn the set of biomarkers listed one per row, each marker followed by the | and PMID of the respective abstract if was mentioned in.\n\nExample: \nInput: 36418457\t[Amyotrophic lateral sclerosis (ALS) is a genetically and phenotypically heterogeneous disease results in the loss of motor neurons. Mounting information points to involvement of other systems including cognitive impairment. However, neither the valid biomarker for diagnosis nor effective therapeutic intervention is available for ALS. The present study is aimed at identifying potentially genetic biomarker that improves the diagnosis and treatment of ALS patients based on the data of the Gene Expression Omnibus. We retrieved datasets and conducted a weighted gene co-expression network analysis (WGCNA) to identify ALS-related co-expression genes. Functional enrichment analysis was performed to determine the features and pathways of the main modules. We then constructed an ALS-related model using the least absolute shrinkage and selection operator (LASSO) regression analysis and verified the model by the receiver operating characteristic (ROC) curve. Besides we screened the non-preserved gene modules in FTD and ALS-mimic disorders to distinct ALS-related genes from disorders with overlapping genes and features. Altogether, 4198 common genes between datasets with the most variation were analyzed and 16 distinct modules were identified through WGCNA. Blue module had the most correlation with ALS and functionally enriched in pathways of neurodegeneration-multiple diseases', 'amyotrophic lateral sclerosis', and 'endocytosis' KEGG terms. Further, some of other modules related to ALS were enriched in 'autophagy' and 'amyotrophic lateral sclerosis'. The 30 top of hub genes were recruited to a LASSO regression model and 5 genes (BCLAF1, GNA13, ARL6IP5, ARGLU1, and YPEL5) were identified as potentially diagnostic ALS biomarkers with validating of the ROC curve and AUC value.]\n\nYour response: BCLAF1|36418457\nGNA13|36418457\nARL6IP5|36418457\nARGLU1|36418457\nYPEL5|36418457",
7070
"userInstruction": null
7171
},

e2e-tests/fixtures/ttyg/agent/get-agent-list.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"topP": 0.0,
88
"seed": null,
99
"repositoryId": "starwars",
10-
"instructions": {
10+
"assistantsInstructions": {
1111
"systemInstruction": "",
1212
"userInstruction": ""
1313
},
@@ -26,7 +26,7 @@
2626
"topP": 0.0,
2727
"seed": null,
2828
"repositoryId": "Not existing repo",
29-
"instructions": {
29+
"assistantsInstructions": {
3030
"systemInstruction": "string\n\nstring",
3131
"userInstruction": "string"
3232
},
@@ -44,7 +44,7 @@
4444
"topP": 1.0,
4545
"seed": null,
4646
"repositoryId": "starwars",
47-
"instructions": {
47+
"assistantsInstructions": {
4848
"systemInstruction": "You are helpful assistant in discovering information regarding diagnostic biomarkers.",
4949
"userInstruction": null
5050
},
@@ -63,7 +63,7 @@
6363
"topP": 1.0,
6464
"seed": null,
6565
"repositoryId": "biomarkers",
66-
"instructions": {
66+
"assistantsInstructions": {
6767
"systemInstruction": "You're a helpful assistant in discovering new diagnostic biomarkers for given diseases. I'll submit a set of publication abstracts discussing given disease and your task is to find in the abstracts any potential new biomarkers which are not yet listed in the appropriate databases. Each abstract is preceded by identifier - its PubMed id called for short PMID. \n\nReturn the set of biomarkers listed one per row, each marker followed by the | and PMID of the respective abstract if was mentioned in.\n\nExample: \nInput: 36418457\t[Amyotrophic lateral sclerosis (ALS) is a genetically and phenotypically heterogeneous disease results in the loss of motor neurons. Mounting information points to involvement of other systems including cognitive impairment. However, neither the valid biomarker for diagnosis nor effective therapeutic intervention is available for ALS. The present study is aimed at identifying potentially genetic biomarker that improves the diagnosis and treatment of ALS patients based on the data of the Gene Expression Omnibus. We retrieved datasets and conducted a weighted gene co-expression network analysis (WGCNA) to identify ALS-related co-expression genes. Functional enrichment analysis was performed to determine the features and pathways of the main modules. We then constructed an ALS-related model using the least absolute shrinkage and selection operator (LASSO) regression analysis and verified the model by the receiver operating characteristic (ROC) curve. Besides we screened the non-preserved gene modules in FTD and ALS-mimic disorders to distinct ALS-related genes from disorders with overlapping genes and features. Altogether, 4198 common genes between datasets with the most variation were analyzed and 16 distinct modules were identified through WGCNA. Blue module had the most correlation with ALS and functionally enriched in pathways of neurodegeneration-multiple diseases', 'amyotrophic lateral sclerosis', and 'endocytosis' KEGG terms. Further, some of other modules related to ALS were enriched in 'autophagy' and 'amyotrophic lateral sclerosis'. The 30 top of hub genes were recruited to a LASSO regression model and 5 genes (BCLAF1, GNA13, ARL6IP5, ARGLU1, and YPEL5) were identified as potentially diagnostic ALS biomarkers with validating of the ROC curve and AUC value.]\n\nYour response: BCLAF1|36418457\nGNA13|36418457\nARL6IP5|36418457\nARGLU1|36418457\nYPEL5|36418457",
6868
"userInstruction": null
6969
},

e2e-tests/fixtures/ttyg/agent/get-agent.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"temperature": 0.7,
66
"topP": 1.0,
77
"repositoryId": "starwars",
8-
"instructions": {
8+
"assistantsInstructions": {
99
"systemInstruction": null,
1010
"userInstruction": null
1111
},

e2e-tests/stubs/ttyg/ttyg-stubs.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import {Stubs} from "../stubs";
22

33
export class TTYGStubs extends Stubs {
44
static stubChatsListGet(fixture = '/ttyg/chats/get-chat-list.json', delay = 0) {
5-
cy.intercept('GET', '/rest/chat/conversations', {
5+
cy.intercept('GET', '/rest/ttyg/chats', {
66
fixture: fixture,
77
statusCode: 200,
88
delay: delay
99
}).as('get-chat-list');
1010
}
1111

1212
static stubChatListGetError() {
13-
cy.intercept('GET', '/rest/chat/conversations', {
13+
cy.intercept('GET', '/rest/ttyg/chats', {
1414
statusCode: 500,
1515
response: {
1616
error: 'Internal Server Error'
@@ -19,7 +19,7 @@ export class TTYGStubs extends Stubs {
1919
}
2020

2121
static stubChatsListGetNoResults() {
22-
cy.intercept('GET', '/rest/chat/conversations', {
22+
cy.intercept('GET', '/rest/ttyg/chats', {
2323
fixture: '/ttyg/chats/get-chat-list-0.json',
2424
statusCode: 200
2525
}).as('get-chat-list');
@@ -34,7 +34,7 @@ export class TTYGStubs extends Stubs {
3434
cy.fixture('/ttyg/chats/get-chat.json').then((body) => {
3535
cy.intercept({
3636
method: 'GET',
37-
url: '/rest/chat/conversations/*'
37+
url: '/rest/ttyg/chats/*'
3838
}, (req) => {
3939
const chatId = req.url.split('/').pop();
4040
const chat = body[chatId];
@@ -49,7 +49,7 @@ export class TTYGStubs extends Stubs {
4949
}
5050

5151
static stubChatGet404Error() {
52-
cy.intercept('GET', '/rest/chat/conversations/*', {
52+
cy.intercept('GET', '/rest/ttyg/chats/*', {
5353
statusCode: 404,
5454
response: {
5555
error: 'Not Found'
@@ -58,28 +58,28 @@ export class TTYGStubs extends Stubs {
5858
}
5959

6060
static stubChatUpdate() {
61-
cy.intercept('PUT', '/rest/chat/conversations/*', {
61+
cy.intercept('PUT', '/rest/ttyg/chats/*', {
6262
fixture: '/ttyg/chats/renamed-chat.json',
6363
statusCode: 200
6464
}).as('update-chat');
6565
}
6666

6767
static stubChatDelete() {
68-
cy.intercept('DELETE', '/rest/chat/conversations/*', {
68+
cy.intercept('DELETE', '/rest/ttyg/chats/*', {
6969
fixture: '/ttyg/chats/deleted-chat.json',
7070
statusCode: 200
7171
}).as('delete-chat');
7272
}
7373

7474
static stubChatExport() {
75-
cy.intercept('GET', '/rest/chat/conversations/export/*', {
75+
cy.intercept('GET', '/rest/ttyg/chats/export/*', {
7676
fixture: '/ttyg/chats/export-chat.json',
7777
statusCode: 200
7878
}).as('export-chat');
7979
}
8080

8181
static stubAgentListGet(fixture = '/ttyg/agent/get-agent-list.json', delay = 0) {
82-
cy.intercept('GET', '/rest/chat/agents', {
82+
cy.intercept('GET', '/rest/ttyg/agents', {
8383
fixture: fixture,
8484
statusCode: 200,
8585
delay: delay
@@ -91,15 +91,15 @@ export class TTYGStubs extends Stubs {
9191
}
9292

9393
static stubAgentGet(fixture = '/ttyg/agent/get-agent.json', delay = 0) {
94-
cy.intercept('GET', '/rest/chat/agents/*', {
94+
cy.intercept('GET', '/rest/ttyg/agents/*', {
9595
fixture: fixture,
9696
statusCode: 200,
9797
delay: delay
9898
}).as('get-agent');
9999
}
100100

101101
static stubAgentListGetError() {
102-
cy.intercept('GET', '/rest/chat/agents', {
102+
cy.intercept('GET', '/rest/ttyg/agents', {
103103
statusCode: 500,
104104
response: {
105105
error: 'Internal Server Error'
@@ -108,7 +108,7 @@ export class TTYGStubs extends Stubs {
108108
}
109109

110110
static stubAgentCreate(delay = 0) {
111-
cy.intercept('POST', '/rest/chat/agents', {
111+
cy.intercept('POST', '/rest/ttyg/agents', {
112112
fixture: '/ttyg/agent/create-agent.json',
113113
statusCode: 200,
114114
delay: delay
@@ -118,7 +118,7 @@ export class TTYGStubs extends Stubs {
118118
static stubAgentEdit() {
119119
cy.intercept({
120120
method: 'PUT',
121-
url: '/rest/chat/agents'
121+
url: '/rest/ttyg/agents'
122122
}, (req) => {
123123
const requestBody = req.body;
124124
req.reply({
@@ -129,21 +129,21 @@ export class TTYGStubs extends Stubs {
129129
}
130130

131131
static stubAgentDelete(delay = 0) {
132-
cy.intercept('DELETE', '/rest/chat/agents/**', {
132+
cy.intercept('DELETE', '/rest/ttyg/agents/**', {
133133
statusCode: 200,
134134
delay: delay
135135
}).as('delete-agent');
136136
}
137137

138138
static stubAgentDefaultsGet() {
139-
cy.intercept('GET', '/rest/chat/agents/default', {
139+
cy.intercept('GET', '/rest/ttyg/agents/default', {
140140
fixture: '/ttyg/agent/get-agent-defaults.json',
141141
statusCode: 200
142142
}).as('get-agent-defaults');
143143
}
144144

145145
static stubAnswerQuestion(fixture = '/ttyg/chats/ask-question.json') {
146-
cy.intercept('POST', '/rest/chat/conversations', {
146+
cy.intercept('POST', '/rest/ttyg/chats', {
147147
fixture,
148148
statusCode: 200
149149
}).as('get-agent-defaults');
@@ -153,7 +153,7 @@ export class TTYGStubs extends Stubs {
153153
cy.fixture(fixture).then((fixtureData) => {
154154
const today = Math.floor(Date.now() / 1000) + '';
155155
const body = JSON.stringify(fixtureData).replace(/"creationDate"/g, today);
156-
cy.intercept('POST', '/rest/chat/conversations', {
156+
cy.intercept('POST', '/rest/ttyg/chats', {
157157
statusCode: 200,
158158
body: JSON.parse(body)
159159
}).as('create-chat');
@@ -162,7 +162,7 @@ export class TTYGStubs extends Stubs {
162162
}
163163

164164
static stubExplainResponse(fixture = '/ttyg/chats/explain-response-1.json') {
165-
cy.intercept('POST', 'rest/chat/conversations/explain', {
165+
cy.intercept('POST', 'rest/ttyg/chats/explain', {
166166
fixture,
167167
statusCode: 200
168168
}).as('explain-response');

packages/legacy-workbench/src/js/angular/rest/ttyg.rest.service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ angular
66

77
TTYGRestService.$inject = ['$http'];
88

9-
const CONVERSATIONS_ENDPOINT = 'rest/chat/conversations';
10-
const AGENTS_ENDPOINT = 'rest/chat/agents';
9+
const CONVERSATIONS_ENDPOINT = 'rest/ttyg/chats';
10+
const AGENTS_ENDPOINT = 'rest/ttyg/agents';
1111
const EXPLAIN_RESPONSE_ENDPOINT = `${CONVERSATIONS_ENDPOINT}/explain`;
1212

1313
const DEVELOPMENT = false;

packages/legacy-workbench/src/js/angular/ttyg/services/agents.mapper.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export const agentModelMapper = (data, localRepositoryIds) => {
175175
temperature: data.temperature,
176176
topP: data.topP,
177177
seed: data.seed,
178-
instructions: agentInstructionsMapper(data.instructions),
178+
instructions: agentInstructionsMapper(data.assistantsInstructions),
179179
assistantExtractionMethods: extractionMethodsMapper(data.assistantExtractionMethods),
180180
additionalExtractionMethods: additionalExtractionMethodsMapper(data.additionalExtractionMethods),
181181
compatibility: data.compatibility,
@@ -186,13 +186,15 @@ const extractionMethodsMapper = (data) => {
186186
if (!data) {
187187
return;
188188
}
189+
189190
return data.map((extractionMethod) => extractionMethodMapper(extractionMethod));
190191
};
191192

192193
const extractionMethodMapper = (data) => {
193194
if (!data) {
194195
return;
195196
}
197+
196198
return new ExtractionMethodModel({
197199
method: data.method,
198200
ontologyGraph: data.ontologyGraph,
@@ -204,12 +206,13 @@ const extractionMethodMapper = (data) => {
204206
queryTemplate: data.queryTemplate,
205207
retrievalConnectorInstance: data.retrievalConnectorInstance
206208
});
207-
};
209+
}
208210

209211
const additionalExtractionMethodsMapper = (data) => {
210212
if (!data) {
211213
return;
212214
}
215+
213216
return data.map((additionalExtractionMethod) => additionalExtractionMethodMapper(additionalExtractionMethod));
214217
};
215218

@@ -227,7 +230,7 @@ const additionalExtractionMethodMapper = (data) => {
227230
method: data.method
228231
});
229232
}
230-
};
233+
}
231234

232235
const agentInstructionsMapper = (data) => {
233236
if (!data) {

0 commit comments

Comments
 (0)