Yesterday I talked about the Smart Paste UI component which should help to automatically fill out a form using data from the user's clipboard. Although the feature worked, the result was weird as an 'of type string' was added to the filled in fields.
Let’s debug the component to understand what is going (wr)on(g).
We start by creating a subclass of type SmartPasteInference
:
We register this class in the DI container before the AddSmartComponents()
:
Add a breakpoint to the BuildPrompt
method to inspect the default prompt and parameters. Run the application in debug mode and hit the 'Paste from clipboard button'
Once the breakpoint is hit, we can see the debugger values:
If we drill down in the Messages property, we see the following 2 messages:
That already explains where the ‘of type string’ is coming from. It seems that Llama3 handles these values literally. Let’s try to update the generated prompt to get a better result.
I took the original source code and tweaked it a little bit to omit the type information:
This time our prompt looks like this;
And this is how the result looks like if we paste the following bug description:
I've found a pretty serious issue where the application crashes whenever you try to save your profile. It doesn't matter what browser or operating system you're using, it happens every time. Basically, you just log in, go to the profile page, fill out the form, and hit save. Instead of saving your profile like it should, the whole application crashes and you get this "500 Internal Server Error" message. This is a high priority issue because it prevents users from updating their profiles.
Much better!