Merge pull request #6474 from continuedev/nate/quick-fixe
Quick fixes (codebase related)
This commit is contained in:
commit
b08d8219ac
3 changed files with 22 additions and 4 deletions
|
|
@ -225,9 +225,11 @@ Determine which tools should be used to answer this query. You should feel free
|
|||
.join("");
|
||||
const parsed = JSON.parse(responseContent);
|
||||
toolCalls = parsed.tools || [];
|
||||
console.log("retrieveWithTools", toolCalls);
|
||||
} catch (e) {
|
||||
console.log("Failed to parse tool selection response", e);
|
||||
console.log(
|
||||
`Failed to parse tool selection response: ${toolSelectionResponse.content}\n\n`,
|
||||
e,
|
||||
);
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -234,6 +234,23 @@ export class LanceDbIndex implements CodebaseIndex {
|
|||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Due to a bug in indexing, some indexes have vectors
|
||||
* without the surrounding []. These would fail to parse
|
||||
* but this allows such existing indexes to function properly
|
||||
*/
|
||||
private parseVector(vector: string): number[] {
|
||||
try {
|
||||
return JSON.parse(vector);
|
||||
} catch (err) {
|
||||
try {
|
||||
return JSON.parse(`[${vector}]`);
|
||||
} catch (err2) {
|
||||
throw new Error(`Failed to parse vector: ${vector}`, { cause: err2 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async *update(
|
||||
tag: IndexTag,
|
||||
results: RefreshIndexResults,
|
||||
|
|
@ -297,7 +314,7 @@ export class LanceDbIndex implements CodebaseIndex {
|
|||
const lanceRows: LanceDbRow[] = [];
|
||||
for (const item of cachedItems) {
|
||||
try {
|
||||
const vector = JSON.parse(item.vector);
|
||||
const vector = this.parseVector(item.vector);
|
||||
const { uuid, startLine, endLine, contents } = item;
|
||||
|
||||
lanceRows.push({
|
||||
|
|
|
|||
|
|
@ -405,7 +405,6 @@ export const sessionSlice = createSlice({
|
|||
}
|
||||
} else if (message.role === "thinking" && message.signature) {
|
||||
if (lastMessage.role === "thinking") {
|
||||
console.log("add signature", message.signature);
|
||||
lastMessage.signature = message.signature;
|
||||
}
|
||||
} else if (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue