Skip to content

[Ctrl+I] intellij Edit bubble can‘t display model name #3733

Closed

Description

@AfterStories

Before submitting your bug report

Relevant environment info

No response

Description

When I select a piece of code and use the CTRL+I shortcut key, as shown in the screenshot, you can see that the model name is not displayed, only show a null ,But pressing the Enter key to send the question can call the API successful, so I think it has get the data in config.json, but it just can't display it

image
And at the same time, the log in the Run Extension window:
Error handling message: {"messageType":"config/getSerializedProfileInfo","data":{"result":{"config":{"allowAnonymousTelemetry":false,"models":[{"provider":"anthropic","model":"Gosu Model","title":"Gosu Model"... ....(After here, it's my config. json content)
java.lang.NullPointerException: null cannot be cast to non-null type kotlin.collections.Map<kotlin.String, kotlin.Any>
Registered handler for editor
image

I recorded a demo video:
https://github.com/user-attachments/assets/d33e7f10-45c7-4443-8440-6cd7158eaf73

To reproduce

No response

Log output

Error handling message: {"messageType":"config/getSerializedProfileInfo","data":{"result":{"config":{"allowAnonymousTelemetry":false,"models":[{"provider":"anthropic","model":"Gosu Model","title":"Gosu Model"...
....(After here, it's my config. json content)


java.lang.NullPointerException: null cannot be cast to non-null type kotlin.collections.Map<kotlin.String, kotlin.Any>`
`Registered handler for editor

Activity

  1. changed the title [-][Ctrl+I] bubble can‘t display model name[/-] [+][Ctrl+I] intellij Edit bubble can‘t display model name[/+] on Jan 15, 2025
  2. added
    ide:jetbrains
    kind:bug
    area:inline-edit
    priority:medium
    on Jan 15, 2025
  3. Patrick-Erichsen commented on Jan 15, 2025

    @Patrick-Erichsen
    Contributor

    @AfterStories can you share your config.json and the version of Continue you are on?

  4. AfterStories commented on Jan 16, 2025

    @AfterStories
    Author

    @Patrick-Erichsen
    I just pulled the latest code from the main branch (latest commit 6c3bbd5). I think the current version is 0.0.85

    The only thing I changed in config.json is model ,And based on my custom deve requirements, I need to display the model name as something like Gosu instead of claude, even though I use anthropic model

    "Gosu" can be displayed under the input box of the chat webview, but it is displayed as null in the Edit bubble. is it can't display a custom string here?

      "allowAnonymousTelemetry": false,
      "models": [
        {
          "model": "Gosu",
          "provider": "anthropic",
          "apiKey": "my key ",
          "title": "Gosu ",
          "apiBase": "my api url",
          "requestOptions": {
            "verifySsl": false
          }
        }
      ]
    
    
  5. Patrick-Erichsen commented on Jan 16, 2025

    @Patrick-Erichsen
    Contributor

    Ah - I wonder if the space is causing issues? Can you trim the trailing space in your title?

    e.g. "title": "Gosu ", -> "title": "Gosu",

  6. AfterStories commented on Jan 17, 2025

    @AfterStories
    Author

    @Patrick-Erichsen
    I accidentally entered a space in that commit,so sorry caused a misunderstanding.
    In fact, there is no space in my config.json, and I thinkI found out what caused this problem:

    InlineEditAction.kt : Line 130

    This is your source code, directly use the response as config :

     continuePluginService.coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response ->
            val config = response as Map<String, Any>
            val models = (config["config"] as Map<String, Any>)["models"] as List<Map<String, Any>>
            modelTitles.addAll(models.map { it["title"] as String })
        }
    
    

    But the config data is in responese. $$\color{red}{\textbf{result}}$$ .config
    After modifying it like this,print some logs,then I can get the config data from the $$\color{red}{\textbf{result}}$$
    in the response obtained contains a layer of $$\color{red}{\textbf{result}}$$ , and then the config is obtained from the $$\color{red}{\textbf{result}}$$

    Image
    Image

    And I can successfully get the value of the modelTitles ,and it can be displayed successfully
    Image

    I don't understand kotlin code, I think maybe my changes are not accurate, so it still need you team as experts to fix the code, thanks~

  7. AfterStories commented on Jan 17, 2025

    @AfterStories
    Author

    And I also found same problem in CoreMessengerManager.kt: Line 63

     val profileInfo = data?.get("config") as? Map<String, Any>
    

    there is a result layer of in data, so profileInfo cannot directly get config here

    Maybe there are similar problems in other files, please check

  8. Patrick-Erichsen commented on Jan 17, 2025

    @Patrick-Erichsen
    Contributor

    @AfterStories excellent work getting to the bottom of this! Made the fix here: https://github.com/continuedev/continue/pull/3754/files

    This will be available in the EAP/pre-release for 0.0.86 we'll be releasing today. Thanks for your help!

  9. lamcodes commented on Jan 19, 2025

    @lamcodes

    @AfterStories excellent work getting to the bottom of this! Made the fix here: https://github.com/continuedev/continue/pull/3754/files

    This will be available in the EAP/pre-release for 0.0.86 we'll be releasing today. Thanks for your help!

    @Patrick-Erichsen
    Hi, just wanted to check if the release has been completed? I don't see the 0.0.86 version available in the EAP/pre-release yet. Thanks for the update!

  10. AfterStories commented on Jan 21, 2025

    @AfterStories
    Author

    @Patrick-Erichsen
    I think your recent other issues fix caused the data structure change again here , so the function is unavailable again

    branch: main
    InlineEditAction.kt Line 132

    Compared to before, there is one more layer of content

    Image

    Image

    maybe continue could try building more sophisticated auto tests script for IntelliJ , so that avoid new fixes affecting old fixes

  11. Patrick-Erichsen commented on Jan 21, 2025

    @Patrick-Erichsen
    Contributor

    Thanks for your patience here @AfterStories , your comment above is accurate and fixed here: #3809

    Also took your advice and added some end-to-end tests for the inline edit feature in that PR 👍

  12. AfterStories commented on Feb 17, 2025

    @AfterStories
    Author

    @Patrick-Erichsen
    Reopen this issue, this problem reappeared, today I tried to pull the latest main branch code to get the latest update, and found that the model name is not displayed.

    Image

    The current problem seems to be caused by async data request, because when I set a breakpoint in the code and execute it step by step, the model name is displayed normally, but when I cancel the breakpoint and press CTRL+I, it shows null. It seems after getting the model data with async request, the interface is not updated? It seems that due to the breakpoint, the async process updates the UI

    InlineEditAction.kt
    I print the log here and see that the model name is right by request
    Image

    then print log in JPanel(MigLayout("insets 0, fillx")).apply

    Image

    Image

    But after getting the model name, I don't know why the UI is not updated to display it.

  13. AfterStories commented on Feb 18, 2025

    @AfterStories
    Author

    @Patrick-Erichsen
    When I set maxWaitTime to 1000, I found that the effect was correct. But only correct in local debug, when I build it as an install package zip, after install plugin ,There is a certain probability that null will still be displayed, and it seems that there is still an asynchronous probleml

    Image

    It is likely related to the asynchronous execution order. When the request is initiated to get modelTitles, the UI rendering may have been performed before the data is ready, so show the null . However, when using breakpoint debugging, the execution speed is slowed down, and the data has enough time to be returned and filled into modelTitles, so the UI can be displayed correctly.
    Maybe my computer has poor performance? 200ms doesn't seem to be enough to return data, Maybe it is safer to set this to 1000ms for users ?However, I think the best way is not to rely on waiting time to solve the asynchronous problem. There is still a chance that null will be displayed.

    continuePluginService.coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response ->
    val content = (response as Map<String, Any>)["content"] as Map<String, Any>
    val result = content["result"] as Map<String, Any>
    val config = result["config"] as Map<String, Any>
    val models = config["models"] as List<Map<String, Any>>
    modelTitles.addAll(models.map { it["title"] as String })
    }
    
    //Change from 200 to 1000, and the effect is correct
    
    val maxWaitTime = 1000 
    val startTime = System.currentTimeMillis()
    while (modelTitles.isEmpty() && System.currentTimeMillis() - startTime < maxWaitTime) {
    Thread.sleep(20)
    }
    
  14. RomneyDa commented on Feb 20, 2025

    @RomneyDa
    Contributor

    @AfterStories thanks for looking into this, I'll take a look today!

  15. RomneyDa commented on Feb 20, 2025

    @RomneyDa
    Contributor

    @AfterStories thanks for digging into this.
    After looking into it I agree with your solution as the simplest bandaid for now.
    Implemented here
    #4263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:inline-editide:jetbrainskind:bugpriority:medium

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions