This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.ai.chat.prompt.Prompt; | |
import org.springframework.ai.vertexai.gemini.VertexAiGeminiChatModel; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.*; | |
@RestController | |
@RequestMapping("/api/gemini") | |
public class GeminiController { | |
@Autowired |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.ai.chat.prompt.Prompt; | |
import org.springframework.ai.openai.OpenAiChatModel; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestParam; | |
import org.springframework.web.bind.annotation.RestController; | |
@RestController | |
@RequestMapping("/api/openai") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation 'org.springframework.boot:spring-boot-starter-web' | |
implementation 'org.springframework.ai:spring-ai-openai-spring-boot-starter' | |
implementation 'org.springframework.ai:spring-ai-vertex-ai-gemini-spring-boot-starter' | |
testImplementation 'org.springframework.boot:spring-boot-starter-test' | |
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
@SpringBootApplication | |
public class ChatAppSpringApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(ChatAppSpringApplication.class, args); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'app-password-field', | |
templateUrl: './password-field.component.html', | |
standalone: true, | |
changeDetection: ChangeDetectionStrategy.OnPush, | |
imports: [ReactiveFormsModule, StrengthMeterComponent] | |
}) | |
export class PasswordFieldComponent implements OnInit { | |
destroyRef = inject(DestroyRef); | |
@Input() passwordFormControl: FormControl = new FormControl<any>(''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nameAlreadyExists: boolean = false; | |
private notifyParentComponentWhenNameChanges(): void { | |
this.form | |
?.get('name') | |
?.valueChanges.pipe( | |
takeUntilDestroyed(this.destroyRef), | |
debounceTime(300), // debounce user input | |
distinctUntilChanged() | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'app-ecs-field', | |
templateUrl: './ecs-field.component.html', | |
changeDetection: ChangeDetectionStrategy.OnPush, | |
}) | |
export class EcsFieldComponent implements OnInit, OnChanges { | |
private storeService = inject(EcsFieldsStoreService); | |
nameAlreadyExists: boolean = false; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'app-ecs-field', | |
templateUrl: './ecs-field.component.html', | |
changeDetection: ChangeDetectionStrategy.OnPush, | |
}) | |
export class EcsFieldComponent { | |
formBuilder = inject(FormBuilder); | |
@Input() entity: EcsField; | |
@Input() nameAlreadyExists: boolean | null = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'app-ecs-fieldset', | |
templateUrl: './ecs-fieldset.component.html', | |
changeDetection: ChangeDetectionStrategy.OnPush, | |
}) | |
export class EcsFieldsetComponent { | |
formBuilder = inject(FormBuilder); | |
@Input() entity: EcsFieldset; | |
@Input() nameAlreadyExists: boolean | null = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ng-container *ngIf="isCreateMode"> | |
<div class="mt-0"> | |
<app-create-custom-field | |
[ecsFieldset]="entity.id!" | |
[nameAlreadyExists]="nameAlreadyExists" | |
(checkIfNameExists)="checkIfNameExists.emit($event)" | |
(cancelEdit)="cancelEdit.emit()" | |
(save)="createCustomField.emit($event)" | |
> | |
</app-create-custom-field> |
NewerOlder