Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GuillaumeDaviid/e210cb47fe4883e41647cbaac1696a6b to your computer and use it in GitHub Desktop.
Save GuillaumeDaviid/e210cb47fe4883e41647cbaac1696a6b to your computer and use it in GitHub Desktop.
Angular IA, chat composant ts
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