return code inside a markdown block during inline assist (#3137)

Reverted prior small change in inline prompting.
We should now only return code in a markdown block during inline
assists.
This commit is contained in:
Kyle Caverly 2023-10-18 10:40:53 -04:00 committed by GitHub
commit fea6d70d4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -243,7 +243,7 @@ pub fn generate_content_prompt(
}
prompts.push("Never make remarks about the output.".to_string());
prompts.push("Do not return any text, except the generated code.".to_string());
prompts.push("Do not wrap your text in a Markdown block".to_string());
prompts.push("Always wrap your code in a Markdown block".to_string());
let current_messages = [ChatCompletionRequestMessage {
role: "user".to_string(),
@ -256,7 +256,11 @@ pub fn generate_content_prompt(
tiktoken_rs::num_tokens_from_messages(model, &current_messages)
{
let max_token_count = tiktoken_rs::model::get_context_size(model);
let intermediate_token_count = max_token_count - current_token_count;
let intermediate_token_count = if max_token_count > current_token_count {
max_token_count - current_token_count
} else {
0
};
if intermediate_token_count < RESERVED_TOKENS_FOR_GENERATION {
0