-
Notifications
You must be signed in to change notification settings - Fork 273
feat(amazonq): enable @sage, pass feature config to mynahUI #5683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
.../jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/Browser.kt
Fixed
Show fixed
Hide fixed
| // format: '[["key1", {"name":"Feature1","variation":"A","value":true}]]' | ||
| fun getFeatureConfigJsonString(): String { | ||
| val jsonString = featureConfigs.entries.map { (key, value) -> | ||
| "[\"$key\",${Gson().toJson(value)}]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I use objectMapper here then this function would be blocked on IO forever and webview will never load.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and Gson formatted string happens to match what MynahUI requires.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This data in VSC is a JSON.stringfied(JSON.stringfield(Object)). See https://github.com/aws/aws-toolkit-vscode/blob/bb11bd9a4b498b2129085f43217b6b712dbf8c44/packages/amazonq/src/lsp/chat/webviewProvider.ts#L85.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I implement it in this way
val jsonString = featureConfigs.entries.map { (key, value) ->
"[\"$key\",${jacksonObjectMapper().writeValueAsString(value)}]"
}
then it would stuck at public native void park(boolean isAbsolute, long time); of Unsafe.java. It may have sometime to do with featureConfigs list being not thread safe but I don't find a easy fix.
It can also hang at handleMessage function of StreamMessageProducer.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why the key value pairs are not modelled as json in mynah-ui
| // format: '[["key1", {"name":"Feature1","variation":"A","value":true}]]' | ||
| fun getFeatureConfigJsonString(): String { | ||
| val jsonString = featureConfigs.entries.map { (key, value) -> | ||
| "[\"$key\",${Gson().toJson(value)}]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why the key value pairs are not modelled as json in mynah-ui
| val jsonString = featureConfigs.entries.map { (key, value) -> | ||
| "[\"$key\",${Gson().toJson(value)}]" | ||
| } | ||
| return """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we return jsonstring directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it will fail. I spent 6 hours making it correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is trying to deserialize as a typescript MAP on MynahUI end
Types of changes
Description
enable @Sage by passing feature config to mynahUI


Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.