Skip to content
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

Chat: Add support for cody.chat.preInstruction in the new preamble #2255

Merged
merged 5 commits into from
Dec 12, 2023

Conversation

toolmantim
Copy link
Contributor

@toolmantim toolmantim commented Dec 11, 2023

This adds support for the cody.chat.preInstruction setting in simplified chat, especially important now we have a "Chat Settings" button in the top of the chat editor:

Screenshot 2023-12-11 at 11 28 07 pm Screenshot 2023-12-11 at 11 28 13 pm
  • Get it working
  • Tests

Fix #2165

Test plan

  • Edit the setting
  • Type a message

@toolmantim
Copy link
Contributor Author

@beyang @dominiccooney @abeatrix before I go adding tests… does this approach look sound, or would you prefer it another way?

Copy link
Contributor

@dominiccooney dominiccooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

We have that "typed" configuration layer, tests for defaults, etc. but because this is simply "any string" I don't think we need to plumb through that here? @philipp-spiess do you have thoughts?

@toolmantim
Copy link
Contributor Author

@dominiccooney I've just added some tests, if you could quickly give it a re-review

@@ -0,0 +1,87 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
Copy link
Contributor Author

@toolmantim toolmantim Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would have been nice to have an e2e test for this, but our e2e tests aren't very end-to-end and don't go through our prompt construction gear. I glanced at the integration tests, but they seem to be all marked as skipped because the getTranscript function is broken atm. So a unit test it is!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I am surprised that the e2e tests somehow avoid prompt construction.

Unit test seems perfect for this. We will be waiting an hour for test results if we have e2e tests for everything.

@toolmantim toolmantim marked this pull request as ready for review December 12, 2023 05:57
@toolmantim toolmantim requested a review from a team December 12, 2023 05:58
Copy link
Member

@valerybugakov valerybugakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Agree that there's no need to pass cody.chat.preInstruction through our typed getConfiguration wrapper.

Copy link
Contributor

@dominiccooney dominiccooney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thank you for adding a test.

@dominiccooney dominiccooney merged commit 1b64b8a into main Dec 12, 2023
13 checks passed
@dominiccooney dominiccooney deleted the tl/fix-preamble branch December 12, 2023 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: pre-instruction config not working in simplified chat
3 participants