feat: copilot chat with custom questions#5
Conversation
| `${question}` | ||
| ); | ||
| } else { | ||
| return ( |
There was a problem hiding this comment.
no content from the paper is included in the prompt right?
There was a problem hiding this comment.
No, currently it only includes the question
There was a problem hiding this comment.
Is this expected? GPT doesn't have the context to continue the "academic paper" in the Overleaf editor.
There was a problem hiding this comment.
Yes and no. In my examples I usually selected something and asked a question to modify that selected text. Or I asked for non-contextual question such as "create a table to do this or that" which did not require input about the paper. But I agree it could be useful to add context.
|
|
||
| function buildAskPrompt(question: string, selection?: string) { | ||
| if (selection) { | ||
| return ( |
There was a problem hiding this comment.
this prompt seems a bit unclear to me, would it be more intuitive to ask GPT to answer the question based on the selection?
There was a problem hiding this comment.
The issue is that the reply is often:
"Sure thing! In order to solve xxxx you write:"
Where the answer includes a human response and explanation instead of simply giving the answer
There was a problem hiding this comment.
Hence why the prompt is forced to only provide the output
There was a problem hiding this comment.
This part makes sense to me. I'm a bit confused about how the user is expected to use this feature. I think when a user selects some text, they may want to:
1 rewrite the selection maybe with some specific instructions, or
2 ask a question regarding the selection
It looks like the prompt tries to do 1 but it also tries to answer a question.
There was a problem hiding this comment.
I aim to get an improvement/latex as a response rather than an explanation. When selecting text it aims to answer the question with the selection as context.
Other than the existing "improvement" button in this extension the user can ask more specific improvements such as "make this shorter", "change the color of the headings in this table to red",...
When not selecting text it just tries to answer the question with a response that can be inserted into the paper.
So your 1. point is correct. Answering questions about a selection is not my aim with this PR.
Github copilot solves this ambiguity using commands such as /explain and /fix that indicate what you want to do with a selection. Future changes could incorporate something similar.
There was a problem hiding this comment.
... Or we could add a "improve" and "explain" button?
| maxPromptWords = e.detail[CONFIG_MAX_PROMPT_WORDS] || maxPromptWords; | ||
| } | ||
|
|
||
| function onEditorAppend( |
There was a problem hiding this comment.
nit: let's use "insert", since it's not always adding content to the end of the document.
| chrome.commands.onCommand.addListener((command) => { | ||
| if (command === "chat") { | ||
| chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { | ||
| if (tabs && tabs[0] && tabs[0].id) { |
|
I was a bit busy with other work. But I've tested the extension and copilot chat for a month and have some updates pending to this PR that I will push soon. |
This feature adds a keyboard shortcut (default Ctrl+Shift+I) to open Copilot chat to ask a specific question.
Important changes:
that sends a "chat:open" command to the current overleaf tab page to open the chat window.
Design choices:
Images:


Optional todos:
Closes #4