Skip to content

AI Assistant: insert code suggestions straight into the user's code #3369

@josephjclark

Description

@josephjclark

The job_chat service in Apollo has been configured to work more like the Workflow chat, where instead of sending code snippets inline, it sends an attached document which should wholesale replace the user's code.

See apollo for details about how this works OpenFn/apollo#259

In Lightning the ask is something like this:

Image
  • Replace user code with the suggested code that comes back from Apollo in a green/red diff on Monaco
  • Show chat messages with code suggestions attached and let me click back to earlier versions (like workflow "apply" button)
  • There should be 3 buttons in the generated code chip:
    • PREVIEW (default, this generates the green/red via Monaco's built-in diff editor and is what the user sees when the message is received from Apollo)
    • APPLY (this will apply the new code)
    • COPY (this copies the new code to the user's clipboard)
  • When calling the model, always show the CURRENT editor contents, not just whatever was sent last

Note that we need to ensure this works well with the streaming API - where the message text is streamed and the document is appended at the end. There may be nothing to do here, we should just me mindful.

Notes:

  1. Careful of when to go sideBySide and when to go vertical:
Image Image

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions