mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-08-17 19:47:10 +08:00
release: 0.0.41
- 修复内存泄漏问题,该可能导致内存异常占用 - 支持俄语增加翻译范围 - 修复qwen-3.8-max中断问题(mimo也应该属于同一类问题) - 修复claude模型可能无法识别图片问题 @GGHansome - 支持自定义Openai端点 @Sxuan-Coder - WebSearch 接入百度搜索,DuckDuckGo 作为兜底 @杨超 - 修复一些兼容性问题 @kael-odin - 修复window上一些表现问题 @philau2512 🔔 如何让AI自动拉模型配置? (以下为提示词,把地址和密钥换为你的) 我的模型配置在 ~/.cursor-local-assistant-v2/config.yaml,我的API地址是:https://xxx 密钥是xxx,帮我拉所有模型配置进去,不要影响已有模型,根据models标准接口拉取。
This commit is contained in:
@@ -11,7 +11,7 @@ import { normalizePath } from "vite";
|
||||
const traverse = traverseModule.default ?? traverseModule;
|
||||
|
||||
const SOURCE_LANGUAGE = "zh-CN";
|
||||
const SUPPORTED_LOCALES = ["zh-CN", "en-US", "ja-JP"];
|
||||
const SUPPORTED_LOCALES = ["zh-CN", "en-US", "ja-JP", "ru-RU"];
|
||||
const HAN_REGEX = /\p{Script=Han}/u;
|
||||
const JS_HELPERS = {
|
||||
localized: "__i18nLocalized",
|
||||
@@ -490,22 +490,34 @@ function walkTemplateNode(node, visitor) {
|
||||
}
|
||||
}
|
||||
|
||||
function transformVueTemplate(templateCode, filePath, rootDir) {
|
||||
function resolveAbsoluteLoc(sourceCode, sourceOffset, relativeOffset) {
|
||||
const absoluteOffset = sourceOffset + relativeOffset;
|
||||
const prefix = sourceCode.slice(0, absoluteOffset);
|
||||
const lastLineBreak = prefix.lastIndexOf("\n");
|
||||
return {
|
||||
line: prefix.split("\n").length,
|
||||
column: absoluteOffset - lastLineBreak,
|
||||
};
|
||||
}
|
||||
|
||||
function transformVueTemplate(templateCode, filePath, rootDir, options = {}) {
|
||||
const ast = parseTemplate(templateCode, { comments: true });
|
||||
const replacements = [];
|
||||
const records = [];
|
||||
const sourceCode = options.sourceCode ?? templateCode;
|
||||
const sourceOffset = options.sourceOffset ?? 0;
|
||||
const resolveLoc = (node, offset = 0) =>
|
||||
resolveAbsoluteLoc(sourceCode, sourceOffset, node.loc.start.offset + offset);
|
||||
|
||||
walkTemplateNode(ast, (node, parent) => {
|
||||
if (node.type === 2 && containsHan(node.content)) {
|
||||
const canonical = node.content.trim();
|
||||
const record = buildMessageRecord(
|
||||
filePath,
|
||||
rootDir,
|
||||
node.content.trim(),
|
||||
canonical,
|
||||
0,
|
||||
{
|
||||
line: node.loc.start.line,
|
||||
column: node.loc.start.column + 1,
|
||||
},
|
||||
resolveLoc(node, node.content.indexOf(canonical)),
|
||||
);
|
||||
const replacement = createTextNodeReplacement(node.loc.source, record);
|
||||
if (!replacement) {
|
||||
@@ -527,10 +539,7 @@ function transformVueTemplate(templateCode, filePath, rootDir) {
|
||||
rootDir,
|
||||
node.value.content,
|
||||
0,
|
||||
{
|
||||
line: node.loc.start.line,
|
||||
column: node.loc.start.column + 1,
|
||||
},
|
||||
resolveLoc(node),
|
||||
);
|
||||
records.push(record);
|
||||
replacements.push({
|
||||
@@ -552,10 +561,7 @@ function transformVueTemplate(templateCode, filePath, rootDir) {
|
||||
node.content,
|
||||
filePath,
|
||||
rootDir,
|
||||
{
|
||||
line: node.loc.start.line,
|
||||
column: node.loc.start.column + 1,
|
||||
},
|
||||
resolveLoc(node),
|
||||
);
|
||||
if (!transformed.changed) {
|
||||
return;
|
||||
@@ -585,7 +591,10 @@ function transformVueSFC(code, filePath, rootDir) {
|
||||
let changed = false;
|
||||
|
||||
if (descriptor.template) {
|
||||
const templateResult = transformVueTemplate(descriptor.template.content, filePath, rootDir);
|
||||
const templateResult = transformVueTemplate(descriptor.template.content, filePath, rootDir, {
|
||||
sourceCode: code,
|
||||
sourceOffset: descriptor.template.loc.start.offset,
|
||||
});
|
||||
records.push(...templateResult.records);
|
||||
if (templateResult.changed) {
|
||||
changed = true;
|
||||
|
||||
Reference in New Issue
Block a user