+
Skip to content

Avoid some spurious matches by being smarter  #74

@kyleli626

Description

@kyleli626

Right now, we rely on a manual line matching approach to match the output of chats to code. This has a few advantages (as is also the most robust way to do it perhaps)

  1. User can copy paste, apply, etc and we'd still match
  2. If the file changes or the lines are modified and switched around, we still match

The big disadvantage is that there are a lot of false positives or spurious matches! This occurs when chat output doesn't actually correspond to changes. This is because we don't match actual diffs, just the code content outputted by the LLM. The happens a lot when you make a chat that asks to explain something, or because the LLM regurgitates a ton of existing code with the edit.

We could fix this in the far future by associating the chat blocks with diffs, but this would require a deeper integration with the code editors (with apply) and also have to take into account copy and paste diffs (where some code that you copy and paste is unchanged).

The way we would do it today is be smarter with matching and timing. We could sorta solve this by only matching lines that are modified or created after the chat was created. This would prevent matches with changes in the past!

One piece of logic we would have to add is on gait initialization, the initial matched chats have to be exempt from this rule. Maybe for those, we can add a special tag in the kv_store.

Steps to resolve:

  1. Function that returns line-number to date last modified for a file using git log
  2. In filedecoration.ts, modify decorateActive to call this function and pass to matchDifftoFile or utilize this somehow to filter the matches.
  3. When we decorate every single file, add an exemption to the kv_store thing. This can be a parameter.

This might be a bit complicated, feel free to ask questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载