mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
Prepare to debug
This commit is contained in:
parent
f6cad40a44
commit
9ecf596cbb
2 changed files with 8 additions and 9 deletions
|
|
@ -545,7 +545,7 @@ ${newFileStr}
|
|||
messages: [{ role: 'assistant', content: rewriteFileWithDiffInstructions, }, { role: 'assistant', content: promptContent, }],
|
||||
onText,
|
||||
onFinalMessage: (finalMessage) => { res(finalMessage) },
|
||||
onError: () => { res(''); console.error('Error rewriting file with diff') },
|
||||
onError: (e) => { res(''); console.error('Error rewriting file with diff', e) },
|
||||
voidConfig: {
|
||||
...voidConfig,
|
||||
default: {
|
||||
|
|
@ -561,7 +561,7 @@ ${newFileStr}
|
|||
|
||||
}
|
||||
|
||||
const shouldApplyDiffFn = async ({ diff, fileStr, speculationStr, type, voidConfig, setAbort }: { diff: string, fileStr: string, speculationStr: string, type: 'line' | 'chunk', voidConfig: VoidConfig, setAbort: SetAbort }) => {
|
||||
const shouldApplyDiffFn = ({ diff, fileStr, speculationStr, type, voidConfig, setAbort }: { diff: string, fileStr: string, speculationStr: string, type: 'line' | 'chunk', voidConfig: VoidConfig, setAbort: SetAbort }) => {
|
||||
|
||||
const promptContent = (
|
||||
// the speculation is a line
|
||||
|
|
@ -620,9 +620,9 @@ Return \`true\` if this any part of the chunk should be modified, and \`false\`
|
|||
.includes('true')
|
||||
res(containsTrue)
|
||||
},
|
||||
onError: () => {
|
||||
onError: (e) => {
|
||||
res(false);
|
||||
console.error('Error applying diff to line')
|
||||
console.error('Error applying diff to line: ', e)
|
||||
},
|
||||
voidConfig,
|
||||
setAbort,
|
||||
|
|
@ -679,7 +679,7 @@ const applyDiffLazily = async ({ fileUri, fileStr, diff, voidConfig, setAbort }:
|
|||
diff,
|
||||
fileUri,
|
||||
voidConfig,
|
||||
onText: async (text) => {
|
||||
onText: async (newText, fullText) => {
|
||||
// TODO! update highlighting here
|
||||
// also make edits here
|
||||
|
||||
|
|
@ -688,10 +688,6 @@ const applyDiffLazily = async ({ fileUri, fileStr, diff, voidConfig, setAbort }:
|
|||
})
|
||||
completedLines.push(changeStr)
|
||||
|
||||
|
||||
// if there's matchup with the file, we stop rewriting
|
||||
// TODO! otherwise keep rewriting until there is matchup
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,6 +278,9 @@ const sendGreptileMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFin
|
|||
export const sendLLMMessage: SendLLMMessageFnTypeExternal = ({ messages, onText, onFinalMessage, onError, voidConfig, setAbort }) => {
|
||||
if (!voidConfig) return;
|
||||
|
||||
// trim message content (Anthropic and other providers give an error if there is trailing whitespace)
|
||||
messages = messages.map(m => ({ ...m, content: m.content.trim() }))
|
||||
|
||||
switch (voidConfig.default.whichApi) {
|
||||
case 'anthropic':
|
||||
return sendAnthropicMsg({ messages, onText, onFinalMessage, onError, voidConfig, setAbort });
|
||||
|
|
|
|||
Loading…
Reference in a new issue