feat(sdk): add basic chat ui example#2064
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds a basic chat UI example, which is a great addition to demonstrate the SDK's capabilities. The implementation is solid, using modern React features and good practices for state management and asynchronous operations. I've identified a few areas for improvement, mainly concerning security best practices with permissions and a couple of minor code refinements for better correctness and maintainability. Overall, it's a well-structured example.
| async function createClient(contextToken: ContextToken) { | ||
| const fetchImpl = createAuthenticatedFetch(contextToken.token); | ||
|
|
||
| const factory = new ClientFactory( | ||
| ClientFactoryOptions.createFrom(ClientFactoryOptions.default, { | ||
| transports: [new JsonRpcTransportFactory({ fetchImpl })], | ||
| cardResolver: new DefaultAgentCardResolver({ fetchImpl }), | ||
| }), | ||
| ); | ||
|
|
||
| const agentCardPath = getAgentCardPath(PROVIDER_ID); | ||
| const client = await factory.createFromUrl(BASE_URL, agentCardPath); | ||
|
|
||
| return client; | ||
| } |
There was a problem hiding this comment.
I wonder if it would make sense to create an abstraction for this in our sdk?
| @@ -0,0 +1,31 @@ | |||
| /** | |||
There was a problem hiding this comment.
Please add documentation page where you link this example as well as some description and overall page descirbing what you had to do etc.
There was a problem hiding this comment.
@jenna-winkler what's your take on this.
I was hoping we would squeze whole workign example in the docs itself, but that would make the page extremly long.
There was a problem hiding this comment.
Yes let’s do a docs page - a guide on approach to building and link to example
There was a problem hiding this comment.
I added a new Custom UI Architecture Guide page to docs. I'd appreciate any feedback.
There was a problem hiding this comment.
Thanks @PetrBulanek ! @sandijean90 can you please review ?
There was a problem hiding this comment.
I’m merging this so we can include it in the RC release.
@sandijean90 If you have any comments or concerns, please open a follow-up issue and I can address them there.
Thanks!
There was a problem hiding this comment.
@PetrBulanek @jenna-winkler thanks! I will take a look today/early next week at the whole Client SDk docs section as I need to familiarize myself before making comments/edits.
4fffcc1 to
2e19b85
Compare
Signed-off-by: Petr Bulánek <bulanek.petr@gmail.com>
Signed-off-by: Petr Bulánek <bulanek.petr@gmail.com>
f447115 to
4fb8724
Compare
| @@ -0,0 +1,31 @@ | |||
| /** | |||
Summary
Add basic chat ui example of how the client SDK can be used to build custom ui.
Linked Issues
Closes: #1749
Documentation
If this PR adds new feature or changes existing. Make sure documentation is adjusted accordingly. If the docs is not needed, please explain why.