Skip to content

How to send a request in chat view programmatically? #15053

Answered by planger
lqd1434 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @lqd1434,

to submit a request in the chat programmatically, you can use the ChatService. Below at the example of creating a new session and submitting a new request from a command handler.

@injectable()
export class SampleCommandContribution implements CommandContribution {

    @inject(ChatService)
    protected readonly chatService: ChatService;

    registerCommands(commands: CommandRegistry): void {
        commands.registerCommand(SampleCommand, {
            execute: async () => {
                // creates a clean session
                const session = this.chatService.createSession(ChatAgentLocation.Panel, { focus: true });
                // submit a request
                a…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by lqd1434
Comment options

You must be logged in to vote
1 reply
@planger
Comment options

planger Feb 27, 2025
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants