Skip to content

Commit

Permalink
fix: use add or update method during enhance with ai based on mode (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdeepak-presidio authored Mar 3, 2025
1 parent b1d2a10 commit b236e80
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h1 class="font-semibold">
theme="secondary"
size="sm"
rounded="lg"
(click)="updateRequirementWithAI()"
(click)="enhanceRequirementWithAI()"
[disabled]="requirementForm.invalid"
></app-button>
</div>
Expand Down
16 changes: 15 additions & 1 deletion ui/src/app/pages/edit-solution/edit-solution.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,10 @@ export class EditSolutionComponent {
});
}

addRequirement() {
addRequirement(useAI = false) {
if (
this.requirementForm.getRawValue().expandAI ||
useAI ||
this.uploadedFileContent.length > 0
) {
const body: IAddRequirementRequest = {
Expand Down Expand Up @@ -315,6 +316,19 @@ ${chat.assistant}`,
}
}

enhanceRequirementWithAI(){
switch(this.mode){
case "edit":{
this.updateRequirementWithAI();
break;
}
case "add":{
this.addRequirement(true);
break;
}
}
}

updateChatHistory(chatHistory: any) {
this.store.dispatch(
new UpdateFile(this.absoluteFilePath, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <h1 class="text-normal font-semibold mb-4">
theme="secondary"
size="sm"
rounded="lg"
(click)="updateUserStoryWithAI()"
(click)="enhanceUserStoryWithAI()"
[disabled]="userStoryForm.invalid"
></app-button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,10 @@ export class EditUserStoriesComponent implements OnDestroy {
}
}

addUserStory() {
addUserStory(useAI = false) {
if (
this.userStoryForm.getRawValue().expandAI ||
useAI ||
this.uploadedFileContent.length > 0
) {
const body: IUpdateUserStoryRequest = {
Expand Down Expand Up @@ -403,6 +404,19 @@ export class EditUserStoriesComponent implements OnDestroy {
});
}

enhanceUserStoryWithAI(){
switch(this.mode){
case "edit":{
this.updateUserStoryWithAI();
break;
}
case "add":{
this.addUserStory(true);
break;
}
}
}

handleFileContent(content: string) {
this.uploadedFileContent = content;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/pages/tasks/add-task/add-task.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h1 class="text-normal font-semibold mb-4">
theme="secondary"
size="sm"
rounded="lg"
(click)="editTaskWithAI()"
(click)="enhanceTaskWithAI()"
[disabled]="taskForm.invalid"
></app-button>
</div>
Expand Down
17 changes: 15 additions & 2 deletions ui/src/app/pages/tasks/add-task/add-task.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ export class AddTaskComponent implements OnDestroy {
}
}

addTask() {
addTask(useAI = false) {
if (this.taskForm.valid) {
this.logger.debug(this.config);
const newFileName = this.config.fileName.replace('base', 'feature');
this.logger.debug(this.taskForm.getRawValue());
const data = this.taskForm.getRawValue();
if (!data.useGenAI && this.uploadedFileContent.length === 0) {
if (!data.useGenAI && this.uploadedFileContent.length === 0 && !useAI) {
this.store.dispatch(
new CreateNewTask(
{ id: data.id, list: data.list, acceptance: data.acceptance },
Expand Down Expand Up @@ -423,6 +423,19 @@ ${chat.assistant}`,
});
}

enhanceTaskWithAI(){
switch(this.mode){
case "edit":{
this.editTaskWithAI();
break;
}
case "add":{
this.addTask(true);
break;
}
}
}

handleFileContent(content: string) {
this.logger.debug(content);
this.uploadedFileContent = content;
Expand Down

0 comments on commit b236e80

Please sign in to comment.