WIP
This commit is contained in:
parent
30de64845f
commit
c4d88bc529
3 changed files with 30 additions and 7 deletions
|
@ -2,4 +2,4 @@ This is Zed Markdown.
|
||||||
|
|
||||||
Mention a language model with / at the start of any line, like this:
|
Mention a language model with / at the start of any line, like this:
|
||||||
|
|
||||||
/ What do you think of this idea?
|
/ Expand on this idea
|
||||||
|
|
|
@ -98,17 +98,40 @@ fn assist(
|
||||||
The user's currently selected text is indicated via ->->selected text<-<- surrounding selected text.
|
The user's currently selected text is indicated via ->->selected text<-<- surrounding selected text.
|
||||||
In this sentence, the word ->->example<-<- is selected.
|
In this sentence, the word ->->example<-<- is selected.
|
||||||
Respond to any selected model mention.
|
Respond to any selected model mention.
|
||||||
Summarize each mention in a single short sentence like:
|
Wrap your responses in > < as follows.
|
||||||
> The user selected the word \"example\".
|
>
|
||||||
Then provide your response to that mention below its summary.
|
I think that's a great idea.
|
||||||
|
<
|
||||||
|
If you're responding to a distant mention or multiple mentions, provide context.
|
||||||
|
> Key ideas of generative programming.
|
||||||
|
* Managing context
|
||||||
|
* Managing length
|
||||||
|
* Context distillation
|
||||||
|
- Shrink a context's size without loss of meaning.
|
||||||
|
* Fine-grained version control
|
||||||
|
* Portals to other contexts
|
||||||
|
* Distillation policies
|
||||||
|
* Budgets
|
||||||
|
<
|
||||||
|
|
||||||
|
> Expand on the idea of context distillation.
|
||||||
|
It's important to stay below the model's context size when generative programming.
|
||||||
|
A key technique in doing so is called context distillation... [up to 1 paragraph].
|
||||||
|
|
||||||
|
Questions to consider:
|
||||||
|
-
|
||||||
|
-
|
||||||
|
- [Up to 3 questions]
|
||||||
|
<
|
||||||
"#};
|
"#};
|
||||||
|
|
||||||
|
let selections = editor.selections.all(cx);
|
||||||
let (user_message, insertion_site) = editor.buffer().update(cx, |buffer, cx| {
|
let (user_message, insertion_site) = editor.buffer().update(cx, |buffer, cx| {
|
||||||
// Insert ->-> <-<- around selected text as described in the system prompt above.
|
// Insert ->-> <-<- around selected text as described in the system prompt above.
|
||||||
let snapshot = buffer.snapshot(cx);
|
let snapshot = buffer.snapshot(cx);
|
||||||
let mut user_message = String::new();
|
let mut user_message = String::new();
|
||||||
let mut buffer_offset = 0;
|
let mut buffer_offset = 0;
|
||||||
for selection in editor.selections.all(cx) {
|
for selection in selections {
|
||||||
user_message.extend(snapshot.text_for_range(buffer_offset..selection.start));
|
user_message.extend(snapshot.text_for_range(buffer_offset..selection.start));
|
||||||
user_message.push_str("->->");
|
user_message.push_str("->->");
|
||||||
user_message.extend(snapshot.text_for_range(selection.start..selection.end));
|
user_message.extend(snapshot.text_for_range(selection.start..selection.end));
|
||||||
|
@ -128,7 +151,7 @@ fn assist(
|
||||||
buffer.edit([(snapshot.len()..snapshot.len(), suffix)], None, cx);
|
buffer.edit([(snapshot.len()..snapshot.len(), suffix)], None, cx);
|
||||||
|
|
||||||
let snapshot = buffer.snapshot(cx); // Take a new snapshot after editing.
|
let snapshot = buffer.snapshot(cx); // Take a new snapshot after editing.
|
||||||
let insertion_site = snapshot.len() - 2; // Insert text at end of buffer, with an empty line both above and below.
|
let insertion_site = snapshot.anchor_after(snapshot.len() - 2);
|
||||||
|
|
||||||
(user_message, insertion_site)
|
(user_message, insertion_site)
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name = "Markdown"
|
name = "Markdown"
|
||||||
path_suffixes = ["md", "mdx"]
|
path_suffixes = ["md", "mdx", "zmd"]
|
||||||
brackets = [
|
brackets = [
|
||||||
{ start = "{", end = "}", close = true, newline = true },
|
{ start = "{", end = "}", close = true, newline = true },
|
||||||
{ start = "[", end = "]", close = true, newline = true },
|
{ start = "[", end = "]", close = true, newline = true },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue