update embeddings

This commit is contained in:
duanfuxiang
2025-06-14 09:17:44 +08:00
parent c71a13a659
commit f1ecc16c26
4 changed files with 322 additions and 211 deletions

View File

@@ -258,6 +258,8 @@ export const InlineEdit: React.FC<InlineEditProps> = ({
let fileContent: string;
try {
fileContent = await plugin.app.vault.cachedRead(activeFile);
// 清理null字节防止PostgreSQL UTF8编码错误
fileContent = fileContent.replace(/\0/g, '');
} catch (err) {
const error = err as Error;
console.error(t("inlineEdit.readFileError"), error.message);
@@ -278,7 +280,9 @@ export const InlineEdit: React.FC<InlineEditProps> = ({
return;
}
const oldContent = await plugin.app.vault.read(activeFile);
let oldContent = await plugin.app.vault.read(activeFile);
// 清理null字节防止PostgreSQL UTF8编码错误
oldContent = oldContent.replace(/\0/g, '');
await plugin.app.workspace.getLeaf(true).setViewState({
type: APPLY_VIEW_TYPE,
active: true,