update settings
This commit is contained in:
parent
b943009ade
commit
67c23b871a
@ -245,7 +245,7 @@ export default {
|
|||||||
|
|
||||||
// RAG Section
|
// RAG Section
|
||||||
RAG: {
|
RAG: {
|
||||||
title: 'RAG',
|
title: 'RAG(advanced)',
|
||||||
includePatterns: 'Include patterns',
|
includePatterns: 'Include patterns',
|
||||||
includePatternsDescription: 'If any patterns are specified, ONLY files matching at least one pattern will be included in indexing. One pattern per line. Uses glob patterns (e.g., "notes/*", "*.md"). Leave empty to include all files not excluded by exclude patterns. After changing this, use the command "Rebuild entire vault index" to apply changes.',
|
includePatternsDescription: 'If any patterns are specified, ONLY files matching at least one pattern will be included in indexing. One pattern per line. Uses glob patterns (e.g., "notes/*", "*.md"). Leave empty to include all files not excluded by exclude patterns. After changing this, use the command "Rebuild entire vault index" to apply changes.',
|
||||||
testPatterns: 'Test patterns',
|
testPatterns: 'Test patterns',
|
||||||
@ -269,7 +269,7 @@ export default {
|
|||||||
// AutoComplete Section
|
// AutoComplete Section
|
||||||
AutoComplete: {
|
AutoComplete: {
|
||||||
// Basic AutoComplete Settings
|
// Basic AutoComplete Settings
|
||||||
title: 'AutoComplete',
|
title: 'AutoComplete(advanced)',
|
||||||
enable: 'Enable',
|
enable: 'Enable',
|
||||||
enableDescription: 'If disabled, nothing will trigger the extension or can result in an API call.',
|
enableDescription: 'If disabled, nothing will trigger the extension or can result in an API call.',
|
||||||
cacheCompletions: 'Cache completions',
|
cacheCompletions: 'Cache completions',
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
// import { APPNAME, MINEXCALIDRAWVERSION } from "src/constants/constants";
|
|
||||||
|
|
||||||
// 简体中文
|
// 简体中文
|
||||||
export default {
|
export default {
|
||||||
chat: {
|
chat: {
|
||||||
@ -191,7 +189,7 @@ export default {
|
|||||||
},
|
},
|
||||||
Models: {
|
Models: {
|
||||||
chatModel: '聊天模型:',
|
chatModel: '聊天模型:',
|
||||||
autocompleteModel: '自动完成模型:',
|
autocompleteModel: '自动补全模型:',
|
||||||
embeddingModel: '嵌入模型:',
|
embeddingModel: '嵌入模型:',
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -202,11 +200,11 @@ export default {
|
|||||||
temperatureDescription: '此参数影响采样中的随机性。较低的值会导致更重复和确定性的响应。较高的温度将导致更意外或创造性的响应。默认值:0.0,如果您不确定自己在做什么,请不要更改此值。',
|
temperatureDescription: '此参数影响采样中的随机性。较低的值会导致更重复和确定性的响应。较高的温度将导致更意外或创造性的响应。默认值:0.0,如果您不确定自己在做什么,请不要更改此值。',
|
||||||
topP: 'TopP',
|
topP: 'TopP',
|
||||||
topPDescription: '与 temperature 参数类似,Top P 参数影响采样中的随机性。降低该值将限制模型的标记选择为更可能的标记,而增加该值则会扩展模型对较低可能性标记的选择。默认值:1,如果您不确定自己在做什么,请不要更改此值。',
|
topPDescription: '与 temperature 参数类似,Top P 参数影响采样中的随机性。降低该值将限制模型的标记选择为更可能的标记,而增加该值则会扩展模型对较低可能性标记的选择。默认值:1,如果您不确定自己在做什么,请不要更改此值。',
|
||||||
frequencyPenalty: '频率惩罚',
|
frequencyPenalty: 'frequencyPenalty',
|
||||||
frequencyPenaltyDescription: '此参数根据标记在文本中出现的频率成比例地降低重复该标记的几率。这降低了在响应中重复完全相同文本的可能性。默认值:0.25',
|
frequencyPenaltyDescription: '此参数根据标记在文本中出现的频率成比例地降低重复该标记的几率。这降低了在响应中重复完全相同文本的可能性。默认值:0.25',
|
||||||
presencePenalty: '存在惩罚',
|
presencePenalty: 'presencePenalty',
|
||||||
presencePenaltyDescription: '此参数降低重复文本中任何已出现标记的几率。这增加了在响应中引入新主题的可能性。默认值:2',
|
presencePenaltyDescription: '此参数降低重复文本中任何已出现标记的几率。这增加了在响应中引入新主题的可能性。默认值:2',
|
||||||
maxTokens: '最大 Tokens',
|
maxTokens: 'maxTokens',
|
||||||
maxTokensDescription: '此参数更改模型允许生成的最大 Tokens 数。默认值:4096',
|
maxTokensDescription: '此参数更改模型允许生成的最大 Tokens 数。默认值:4096',
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -248,7 +246,7 @@ export default {
|
|||||||
|
|
||||||
// RAG 部分
|
// RAG 部分
|
||||||
RAG: {
|
RAG: {
|
||||||
title: 'RAG',
|
title: 'RAG(高级)',
|
||||||
includePatterns: '包含模式',
|
includePatterns: '包含模式',
|
||||||
includePatternsDescription: '如果指定了任何模式,则只有匹配至少一个模式的文件才会被包含在索引中。每行一个模式。使用 glob 模式(例如,"notes/*", "*.md")。留空以包含所有未被排除模式排除的文件。更改后,请使用命令 "重建整个 Vault 索引" 来应用更改。',
|
includePatternsDescription: '如果指定了任何模式,则只有匹配至少一个模式的文件才会被包含在索引中。每行一个模式。使用 glob 模式(例如,"notes/*", "*.md")。留空以包含所有未被排除模式排除的文件。更改后,请使用命令 "重建整个 Vault 索引" 来应用更改。',
|
||||||
testPatterns: '测试模式',
|
testPatterns: '测试模式',
|
||||||
@ -272,7 +270,7 @@ export default {
|
|||||||
// 自动完成部分
|
// 自动完成部分
|
||||||
AutoComplete: {
|
AutoComplete: {
|
||||||
// 基本自动完成设置
|
// 基本自动完成设置
|
||||||
title: '自动完成',
|
title: '自动补全(高级)',
|
||||||
enable: '启用',
|
enable: '启用',
|
||||||
enableDescription: '如果禁用,任何操作都不会触发扩展或导致 API 调用。',
|
enableDescription: '如果禁用,任何操作都不会触发扩展或导致 API 调用。',
|
||||||
cacheCompletions: '缓存补全',
|
cacheCompletions: '缓存补全',
|
||||||
|
|||||||
@ -14,9 +14,9 @@ import InfioPlugin from '../main';
|
|||||||
import { InfioSettings } from '../types/settings';
|
import { InfioSettings } from '../types/settings';
|
||||||
import { findFilesMatchingPatterns } from '../utils/glob-utils';
|
import { findFilesMatchingPatterns } from '../utils/glob-utils';
|
||||||
|
|
||||||
import AdvancedSettings from './components/AdvancedSettings';
|
// import AdvancedSettings from './components/AdvancedSettings';
|
||||||
import BasicAutoCompleteSettings from './components/BasicAutoCompleteSettings';
|
import BasicAutoCompleteSettings from './components/BasicAutoCompleteSettings';
|
||||||
import DangerZoneSettings from './components/DangerZoneSettings';
|
// import DangerZoneSettings from './components/DangerZoneSettings';
|
||||||
import CustomProviderSettings from './components/ModelProviderSettings';
|
import CustomProviderSettings from './components/ModelProviderSettings';
|
||||||
import PostprocessingSettings from './components/PostprocessingSettings';
|
import PostprocessingSettings from './components/PostprocessingSettings';
|
||||||
import PreprocessingSettings from './components/PreprocessingSettings';
|
import PreprocessingSettings from './components/PreprocessingSettings';
|
||||||
@ -284,8 +284,55 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderRAGSection(containerEl: HTMLElement): void {
|
renderRAGSection(containerEl: HTMLElement): void {
|
||||||
new Setting(containerEl).setHeading().setName(t('settings.RAG.title'))
|
// 创建一个折叠区域的容器
|
||||||
new Setting(containerEl)
|
const ragContainer = containerEl.createDiv("rag-settings-container");
|
||||||
|
|
||||||
|
// 创建标题元素,添加折叠控件
|
||||||
|
const headerEl = ragContainer.createEl("div", { cls: "infio-collapsible-heading" });
|
||||||
|
|
||||||
|
// 添加展开/折叠指示器
|
||||||
|
const toggleIcon = headerEl.createEl("span", { cls: "infio-toggle-icon" });
|
||||||
|
toggleIcon.textContent = "▶"; // 默认为折叠状态,使用右箭头
|
||||||
|
|
||||||
|
// 添加标题文本
|
||||||
|
const titleEl = headerEl.createEl("h3", { text: t('settings.RAG.title') });
|
||||||
|
|
||||||
|
// 创建内容容器
|
||||||
|
const contentContainer = ragContainer.createEl("div", { cls: "infio-collapsible-content" });
|
||||||
|
|
||||||
|
// 默认设置为隐藏状态
|
||||||
|
contentContainer.style.display = "none";
|
||||||
|
|
||||||
|
// 添加点击事件处理
|
||||||
|
headerEl.addEventListener("click", () => {
|
||||||
|
if (contentContainer.style.display === "none") {
|
||||||
|
contentContainer.style.display = "block";
|
||||||
|
toggleIcon.textContent = "▼"; // 展开状态使用下箭头
|
||||||
|
toggleIcon.style.transform = "rotate(0deg)";
|
||||||
|
} else {
|
||||||
|
contentContainer.style.display = "none";
|
||||||
|
toggleIcon.textContent = "▶"; // 折叠状态使用右箭头
|
||||||
|
toggleIcon.style.transform = "rotate(0deg)";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 添加样式
|
||||||
|
headerEl.style.cursor = "pointer";
|
||||||
|
headerEl.style.display = "flex";
|
||||||
|
headerEl.style.alignItems = "center";
|
||||||
|
headerEl.style.marginBottom = "10px";
|
||||||
|
headerEl.style.padding = "6px 0";
|
||||||
|
|
||||||
|
toggleIcon.style.marginRight = "5px";
|
||||||
|
toggleIcon.style.fontSize = "10px";
|
||||||
|
toggleIcon.style.transition = "transform 0.15s ease";
|
||||||
|
|
||||||
|
titleEl.style.margin = "0";
|
||||||
|
titleEl.style.fontSize = "16px";
|
||||||
|
titleEl.style.fontWeight = "600";
|
||||||
|
|
||||||
|
// 以下是原有的设置内容,移动到内容容器中
|
||||||
|
new Setting(contentContainer)
|
||||||
.setName(t('settings.RAG.includePatterns'))
|
.setName(t('settings.RAG.includePatterns'))
|
||||||
.setDesc(
|
.setDesc(
|
||||||
t('settings.RAG.includePatternsDescription'),
|
t('settings.RAG.includePatternsDescription'),
|
||||||
@ -300,7 +347,7 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
new IncludedFilesModal(this.app, includedFiles, patterns).open()
|
new IncludedFilesModal(this.app, includedFiles, patterns).open()
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
new Setting(containerEl)
|
new Setting(contentContainer)
|
||||||
.setClass('infio-chat-settings-textarea')
|
.setClass('infio-chat-settings-textarea')
|
||||||
.addTextArea((text) =>
|
.addTextArea((text) =>
|
||||||
text
|
text
|
||||||
@ -320,7 +367,7 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(contentContainer)
|
||||||
.setName(t('settings.RAG.excludePatterns'))
|
.setName(t('settings.RAG.excludePatterns'))
|
||||||
.setDesc(
|
.setDesc(
|
||||||
t('settings.RAG.excludePatternsDescription'),
|
t('settings.RAG.excludePatternsDescription'),
|
||||||
@ -335,7 +382,7 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
new ExcludedFilesModal(this.app, excludedFiles).open()
|
new ExcludedFilesModal(this.app, excludedFiles).open()
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
new Setting(containerEl)
|
new Setting(contentContainer)
|
||||||
.setClass('infio-chat-settings-textarea')
|
.setClass('infio-chat-settings-textarea')
|
||||||
.addTextArea((text) =>
|
.addTextArea((text) =>
|
||||||
text
|
text
|
||||||
@ -355,7 +402,7 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(contentContainer)
|
||||||
.setName(t('settings.RAG.chunkSize'))
|
.setName(t('settings.RAG.chunkSize'))
|
||||||
.setDesc(
|
.setDesc(
|
||||||
t('settings.RAG.chunkSizeDescription'),
|
t('settings.RAG.chunkSizeDescription'),
|
||||||
@ -378,7 +425,7 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(contentContainer)
|
||||||
.setName(t('settings.RAG.thresholdTokens'))
|
.setName(t('settings.RAG.thresholdTokens'))
|
||||||
.setDesc(
|
.setDesc(
|
||||||
t('settings.RAG.thresholdTokensDescription'),
|
t('settings.RAG.thresholdTokensDescription'),
|
||||||
@ -401,7 +448,7 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(contentContainer)
|
||||||
.setName(t('settings.RAG.minSimilarity'))
|
.setName(t('settings.RAG.minSimilarity'))
|
||||||
.setDesc(
|
.setDesc(
|
||||||
t('settings.RAG.minSimilarityDescription'),
|
t('settings.RAG.minSimilarityDescription'),
|
||||||
@ -424,7 +471,7 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(contentContainer)
|
||||||
.setName(t('settings.RAG.limit'))
|
.setName(t('settings.RAG.limit'))
|
||||||
.setDesc(
|
.setDesc(
|
||||||
t('settings.RAG.limitDescription'),
|
t('settings.RAG.limitDescription'),
|
||||||
@ -449,10 +496,58 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderAutoCompleteSection(containerEl: HTMLElement): void {
|
renderAutoCompleteSection(containerEl: HTMLElement): void {
|
||||||
// 创建一个专门的容器来存放 AutoComplete 相关的组件
|
// 创建一个折叠区域的容器
|
||||||
const autoCompleteDiv = containerEl.createDiv("auto-complete-section");
|
const autoCompleteContainer = containerEl.createDiv("auto-complete-settings-container");
|
||||||
this.autoCompleteContainer = autoCompleteDiv;
|
|
||||||
this.renderAutoCompleteContent(autoCompleteDiv);
|
// 创建标题元素,添加折叠控件
|
||||||
|
const headerEl = autoCompleteContainer.createEl("div", { cls: "infio-collapsible-heading" });
|
||||||
|
|
||||||
|
// 添加展开/折叠指示器
|
||||||
|
const toggleIcon = headerEl.createEl("span", { cls: "infio-toggle-icon" });
|
||||||
|
toggleIcon.textContent = "▶"; // 默认为折叠状态,使用右箭头
|
||||||
|
|
||||||
|
// 添加标题文本
|
||||||
|
const titleEl = headerEl.createEl("h3", { text: t('settings.AutoComplete.title') });
|
||||||
|
|
||||||
|
// 创建内容容器
|
||||||
|
const contentContainer = autoCompleteContainer.createEl("div", { cls: "infio-collapsible-content" });
|
||||||
|
|
||||||
|
// 保存容器引用
|
||||||
|
this.autoCompleteContainer = contentContainer;
|
||||||
|
|
||||||
|
// 默认设置为隐藏状态
|
||||||
|
contentContainer.style.display = "none";
|
||||||
|
|
||||||
|
// 添加点击事件处理
|
||||||
|
headerEl.addEventListener("click", () => {
|
||||||
|
if (contentContainer.style.display === "none") {
|
||||||
|
contentContainer.style.display = "block";
|
||||||
|
toggleIcon.textContent = "▼"; // 展开状态使用下箭头
|
||||||
|
toggleIcon.style.transform = "rotate(0deg)";
|
||||||
|
} else {
|
||||||
|
contentContainer.style.display = "none";
|
||||||
|
toggleIcon.textContent = "▶"; // 折叠状态使用右箭头
|
||||||
|
toggleIcon.style.transform = "rotate(0deg)";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 添加样式
|
||||||
|
headerEl.style.cursor = "pointer";
|
||||||
|
headerEl.style.display = "flex";
|
||||||
|
headerEl.style.alignItems = "center";
|
||||||
|
headerEl.style.marginBottom = "10px";
|
||||||
|
headerEl.style.padding = "6px 0";
|
||||||
|
|
||||||
|
toggleIcon.style.marginRight = "5px";
|
||||||
|
toggleIcon.style.fontSize = "10px";
|
||||||
|
toggleIcon.style.transition = "transform 0.15s ease";
|
||||||
|
|
||||||
|
titleEl.style.margin = "0";
|
||||||
|
titleEl.style.fontSize = "16px";
|
||||||
|
titleEl.style.fontWeight = "600";
|
||||||
|
|
||||||
|
// 在内容容器中渲染AutoComplete设置
|
||||||
|
this.renderAutoCompleteContent(contentContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderAutoCompleteContent(containerEl: HTMLElement): void {
|
private renderAutoCompleteContent(containerEl: HTMLElement): void {
|
||||||
@ -472,7 +567,7 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
const errors = new Map();
|
const errors = new Map();
|
||||||
|
|
||||||
// AutoComplete base
|
// AutoComplete base
|
||||||
new Setting(containerEl).setName(t('settings.AutoComplete.title')).setHeading();
|
// new Setting(containerEl).setName(t('settings.AutoComplete.title')).setHeading();
|
||||||
this.renderComponent(containerEl,
|
this.renderComponent(containerEl,
|
||||||
<BasicAutoCompleteSettings
|
<BasicAutoCompleteSettings
|
||||||
settings={this.plugin.settings}
|
settings={this.plugin.settings}
|
||||||
@ -519,29 +614,30 @@ export class InfioSettingTab extends PluginSettingTab {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
// Danger zone
|
// // Danger zone
|
||||||
new Setting(containerEl).setName(t('settings.AutoComplete.dangerZone.title')).setHeading();
|
// new Setting(containerEl).setName(t('settings.AutoComplete.dangerZone.title')).setHeading();
|
||||||
this.renderComponent(containerEl,
|
// this.renderComponent(containerEl,
|
||||||
<DangerZoneSettings
|
// <DangerZoneSettings
|
||||||
settings={this.plugin.settings}
|
// settings={this.plugin.settings}
|
||||||
updateSettings={updateSettings}
|
// updateSettings={updateSettings}
|
||||||
onReset={() => {
|
// onReset={() => {
|
||||||
new Notice(t('settings.AutoComplete.dangerZone.resetComplete'));
|
// new Notice(t('settings.AutoComplete.dangerZone.resetComplete'));
|
||||||
}}
|
// }}
|
||||||
/>
|
// />
|
||||||
);
|
// );
|
||||||
|
|
||||||
// Advanced
|
// // Advanced
|
||||||
if (this.plugin.settings.advancedMode) {
|
|
||||||
new Setting(containerEl).setName(t('settings.AutoComplete.advanced.title')).setHeading();
|
// if (this.plugin.settings.advancedMode) {
|
||||||
this.renderComponent(containerEl,
|
// new Setting(containerEl).setName(t('settings.AutoComplete.advanced.title')).setHeading();
|
||||||
<AdvancedSettings
|
// this.renderComponent(containerEl,
|
||||||
settings={this.plugin.settings}
|
// <AdvancedSettings
|
||||||
updateSettings={updateSettings}
|
// settings={this.plugin.settings}
|
||||||
errors={errors}
|
// updateSettings={updateSettings}
|
||||||
/>
|
// errors={errors}
|
||||||
);
|
// />
|
||||||
}
|
// );
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderComponent(containerEl: HTMLElement, component: React.ReactNode) {
|
private renderComponent(containerEl: HTMLElement, component: React.ReactNode) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user