Created
October 13, 2023 09:24
-
-
Save GuillaumeDaviid/e210cb47fe4883e41647cbaac1696a6b to your computer and use it in GitHub Desktop.
Angular IA, chat composant ts
This file contains 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 { Component } from '@angular/core'; | |
import { OpenAiService } from '../open-ai.service' | |
@Component({ | |
selector: 'app-chat', | |
templateUrl: './chat.component.html', | |
styleUrls: ['./chat.component.scss'] | |
}) | |
export class ChatComponent { | |
newMsg: string = ''; | |
botResponse: string = ''; | |
constructor(private openAiService: OpenAiService) {} | |
handleClick() { | |
this.openAiService.getDataFromOpenAI(this.newMsg).subscribe(data => { | |
this.botResponse = data; | |
}); | |
this.newMsg = ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment