feat: 标记模式(>>)与设置项明文显示;自定义模型/Base URL 支持 #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
背景
这次改动做了什么
>>;可选后缀(如<<)用于短语包裹。notepadId、openaiBaseUrl、openaiModel、bigModelModel、标记符相关配置等)。openaiBaseUrl支持自定义(将被拼接为${base}/v1/responses)。openaiModel、bigModelModel支持任意自定义文本值。新增/调整的配置项(
public/info.json)markWordsEnabled,默认 true)wordMarkerPrefix,默认>>)wordMarkerSuffix,默认空;如设置为<<则支持包裹短语:>>New York<<)maxMarkedWordTokens,默认4)overrideCanAddSentenceWhenMarked,默认 true)stripMarkersBeforeTranslate,默认 true)maimemoToken/openaiApiKey/bigModelApiKey为 secure行为说明与兼容性
示例
I like >>apple and >>banana.解析:词 =
apple, banana;例句 =I like apple and banana.<<):>>New York<< is great.解析:词 =
New York;例句 =New York is great.openaiBaseUrl = https://your-proxy.example.com/openaiModel = gpt-4.1-mini(或第三方侧实际可用的模型名)注意事项
/v1/responses),不等同于 Chat Completions。如果第三方仅支持/v1/chat/completions,会翻译失败。<<),输入中也必须成对出现(>>短语<<)才能命中短语模式;仅写>>word将不被短语模式匹配。detectFrom === "en"的场景下添加单词。文件变更(核心)
src/analyze.ts:新增标记解析器(解析标记词、清理句子、参数化配置)src/index.ts:接入标记模式与兼容回退逻辑;放宽早退条件public/info.json:新增并调整配置项、优化输入框可见性src/types.ts:补充新增配置项类型appcast.json测试要点
>>word:应识别并添加单词,例句为移除标记符后的文本>>短语<<(开启后缀):应识别短语并添加后续可选改进
感谢审阅!如果需要,我可以根据维护者建议进一步拆分 PR 或补充文档与测试说明。