Skip to content

Commit

Permalink
New Features:
Browse files Browse the repository at this point in the history
1. AI for creating system tests finished
New Pages:
Bugs Corrected:
To Be Corrected:
0. On product delete, delete trace results
1. On product delete, delete flamegraph result
  • Loading branch information
juanfranciscocis committed Sep 3, 2024
1 parent d8d06c9 commit d32b154
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,24 @@ <h1>{{step.stepTitle}}</h1>
</div>
</ion-card>
<ion-card>
<ion-card-content>


@if (disableAI){
<div class=" rounded-full p-3 bg-gray-400 flex flex-row justify-center items-center">
<ion-card-content class="hidden">
<div class=" rounded-full p-3 bg-gray-400 flex flex-row justify-center items-center hidden">
<ion-icon name="color-wand-outline" class="hidden"></ion-icon>
</div>
</ion-card-content>
}

@if (!disableAI){
<ion-card-content class="">
<div class=" rounded-full p-3 bg-purple-800 flex flex-row justify-center items-center">
<ion-icon name="color-wand-outline" (click)="askAIForHelp('step')" ></ion-icon>
</div>
</ion-card-content>
}

</ion-card-content>
<ion-card-content>
<ion-label>DevProbe AI Answer</ion-label>
</ion-card-content>
Expand All @@ -118,4 +121,11 @@ <h1>{{step.stepTitle}}</h1>
</ng-template>
</ion-modal>

<ion-fab class="m-2 z-10" vertical="bottom" horizontal="end" slot="fixed" (click)="giveContext()">
<ion-avatar class="bg-purple-300 p-4">
<ion-icon class="w-full h-full" name="chatbubble-outline"></ion-icon>
</ion-avatar>
</ion-fab>

</ion-content>

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class CreateSystemTestPage implements OnInit {
aiSteps:AiMessage[] = [];
extraData: string = '';
disableAI: boolean = false;
showContext: boolean = false;



Expand Down Expand Up @@ -211,14 +212,14 @@ export class CreateSystemTestPage implements OnInit {

if (!this.systemTest.title || this.systemTest.title === '') {
await this.hideLoading();
this.showAlert('Please fill out the title of the test before asking for help with the description.', 'Error').then(r =>
await this.showAlert('Please fill out the title of the test before asking for help with the description.', 'Error').then(r =>
console.log('Alert shown'));
return;
}


let chat = this.model.startChat(forDescription as any);
let msg = "Given this test title:" + this.systemTest.title + "I need help to create the description of the test, just give me the test main objective";
let msg = "Given this test title:" + this.systemTest.title + ". Here is more information about the test: " + this.extraData + "I need help to create the description of the test, just give me the test main objective";
console.log(msg);
await chat.sendMessage(msg).then(response => {
this.systemTest.description = response.response.text();
Expand All @@ -231,7 +232,7 @@ export class CreateSystemTestPage implements OnInit {

if (!this.systemTest.title || this.systemTest.title === '' || !this.systemTest.description || this.systemTest.description === '') {
await this.hideLoading();
this.showAlert('Please fill out the title and description of the test before asking for help with the steps.', 'Error').then(r =>
await this.showAlert('Please fill out the title and description of the test before asking for help with the steps.', 'Error').then(r =>
console.log('Alert shown'));
return;
}
Expand Down Expand Up @@ -299,11 +300,54 @@ export class CreateSystemTestPage implements OnInit {
}

for (var i = 0; i < ul.length; i++) {
ul[i].style.fontSize = "1em";
// add a - before the text
ul[i].innerHTML = " - " + ul[i].innerHTML;
console.log(ul[i].innerHTML);
//get the ul li elements
let ulLi = ul[i].getElementsByTagName("li");
for (var j = 0; j < ulLi.length; j++) {
ulLi[j].style.fontSize = "0.5em";
// add a - before the text
ulLi[j].innerHTML = "- " + ulLi[j].innerHTML;
console.log(ulLi[j].innerHTML);
}
}

}




giveContext() {
let alertButtons = ['Give Context', 'Cancel'];
let alertInputs = [
{
name: 'context',
type: 'text',
placeholder: 'Give AI Context'
}
];

this.showAlertWithInputs('Give Global Test Context', 'Please provide the AI with some context, provide code, HTML, or instructions.' , alertButtons, alertInputs).then(r =>
console.log('Alert shown')
);
}

async showAlertWithInputs(header:string, message:string, buttons:string[], inputs:any[]) {
const alert = await this.alertCtrl.create({
header: header,
message: message,
buttons: buttons,
inputs: inputs
});
await alert.present();

// Get the alert inputs
const { data } = await alert.onDidDismiss();
console.log(data);
if (data.values) {
this.extraData = data.values.context;
this.showContext = true;
}
console.log(this.extraData);
}


}
1 change: 1 addition & 0 deletions www/1143.0dd15591a6841da8.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d32b154

Please sign in to comment.