Skip to content

Conversation

OskarStark
Copy link
Contributor

@OskarStark OskarStark commented Sep 1, 2025

Q A
Bug fix? no
New feature? yes
Docs? no
Issues --
License MIT

Implement a new console command bin/console ai:chat that allows users to interactively chat with different AI agents (blog, stream, youtube, wikipedia, audio). The command supports custom system prompts and maintains conversation history.

Demo

CleanShot 2025-09-03 at 07 57 09@2x CleanShot 2025-09-03 at 07 56 53@2x

@carsonbot carsonbot added AI Bundle Issues & PRs about the AI integration bundle Feature New feature Status: Needs Review labels Sep 1, 2025
@OskarStark OskarStark force-pushed the feature/chat-command branch 2 times, most recently from be7fc49 to 7429039 Compare September 2, 2025 06:09
@OskarStark
Copy link
Contributor Author

Ready for review

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature!
I think there are small details we can improve.

@OskarStark
Copy link
Contributor Author

Ready to merge from my side

@GromNaN GromNaN self-requested a review September 2, 2025 19:48
@OskarStark OskarStark force-pushed the feature/chat-command branch 2 times, most recently from 3a9bf1a to 73ba017 Compare September 2, 2025 20:42
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great for testing 👍

@chr-hertel
Copy link
Member

oh, i wonder, did you try to use streaming? otherwise maybe a follow up

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found that one bug about the ChoiceQuestion

@OskarStark
Copy link
Contributor Author

oh, i wonder, did you try to use streaming? otherwise maybe a follow up

No not yet, lets follow up

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can simplify by using short agent names everywhere.

@OskarStark
Copy link
Contributor Author

I agree with @GromNaN that we can simplify this a lot if we only allow my_agent instead of ai.agent.my_agent or my_agent

@OskarStark OskarStark requested a review from GromNaN September 2, 2025 21:13
@OskarStark
Copy link
Contributor Author

It works when I provide a correct one, or a wrong one. But it does not work when I provide none... investigating.

@OskarStark
Copy link
Contributor Author

Works now!

@chr-hertel
Copy link
Member

chr-hertel commented Sep 2, 2025

Common, i feel like you're trolling me ... 😂

image

I'm going to bed now - sad :D

@OskarStark
Copy link
Contributor Author

CleanShot 2025-09-03 at 07 56 53@2x CleanShot 2025-09-03 at 07 57 09@2x

@OskarStark
Copy link
Contributor Author

Got a 👍 from @chr-hertel via WhatsApp 😄

@OskarStark OskarStark merged commit b2a1424 into symfony:main Sep 3, 2025
6 checks passed
protected function interact(InputInterface $input, OutputInterface $output): void
{
// Skip interaction in non-interactive mode
if (!$input->isInteractive()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless check. The parent class already skips calling the interact method entirely.

protected function configure(): void
{
$this
->addArgument('agent', InputArgument::OPTIONAL, 'The name of the agent to chat with')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument should be marked as required, as you use the interact method to fill it anyway. this provides better documentation (and standard error reporting)

}

$agentArg = $input->getArgument('agent');
$this->agentName = \is_string($agentArg) ? $agentArg : '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using instance properties (making the service stateful) when they are only used locally ? You should use local variables instead.

@OskarStark OskarStark deleted the feature/chat-command branch September 3, 2025 10:17
@OskarStark
Copy link
Contributor Author

Thanks for your feedback @stof, makes sense

OskarStark added a commit that referenced this pull request Sep 3, 2025
This PR was squashed before being merged into the main branch.

Discussion
----------

[AI Bundle] Improve `ChatCommand`

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| Docs?         | no
| Issues        | Follows #395
| License       | MIT

cc `@stof`

Commits
-------

c0e7f3c [AI Bundle] Improve `ChatCommand`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Bundle Issues & PRs about the AI integration bundle Feature New feature Status: Reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants