1 parent
43ddfce93d
commit
e9998e2806
21 files changed
+563
-7
No files matched your search
@@ -271,6 +271,16 @@ import { useSavedSqlStore } from "@/stores/savedSqlStore";
|
||||
import { usePromptTemplateStore } from "@/stores/promptTemplateStore";
|
||||
import { useTunnelProfileStore } from "@/stores/tunnelProfileStore";
|
||||
import { currentLocale, previewLocale, restoreLocalePreview, setLocale, type Locale } from "@/i18n";
|
||||
import {
|
||||
AI_CONVERSATION_FONT_FAMILY_DEFAULT,
|
||||
AI_CONVERSATION_FONT_SIZE_DEFAULT,
|
||||
AI_CONVERSATION_FONT_SIZE_MAX,
|
||||
AI_CONVERSATION_FONT_SIZE_MIN,
|
||||
aiConversationFontFamilyForName,
|
||||
normalizeAiConversationFontFamily,
|
||||
normalizeAiConversationFontFamilyInput,
|
||||
normalizeAiConversationFontSize,
|
||||
} from "@/lib/ai/aiTypography";
|
||||
import {
|
||||
SETTINGS_SEARCH_DEFINITIONS,
|
||||
TOOLBAR_VISIBILITY_ITEMS,
|
||||
@@ -592,6 +602,9 @@ function createEmptyTableColumnTemplateRow(): TableColumnTemplateGridRow {
|
||||
// Local edit state
|
||||
const editFontFamily = ref(settingsStore.editorSettings.fontFamily);
|
||||
const editFontSize = ref(settingsStore.editorSettings.fontSize);
|
||||
const editAiFontFamily = ref(settingsStore.editorSettings.aiFontFamily);
|
||||
const editAiFontSize = ref<number | string>(settingsStore.editorSettings.aiFontSize);
|
||||
const aiTypographySaving = ref(false);
|
||||
const editTableFontFamily = ref(settingsStore.editorSettings.tableFontFamily);
|
||||
const editUiFontFamily = ref(settingsStore.editorSettings.uiFontFamily);
|
||||
const editUiScale = ref(settingsStore.editorSettings.uiScale);
|
||||
@@ -1589,6 +1602,12 @@ const systemFontOptions = computed(() => {
|
||||
|
||||
const tableFontOptions = computed(() => buildFontFamilyOptions(systemFonts.value, [editTableFontFamily.value], [DEFAULT_DATA_GRID_FONT_FAMILY]));
|
||||
|
||||
const aiFontOptions = computed(() => {
|
||||
const options = new Set([DEFAULT_UI_FONT_FAMILY, SYSTEM_UI_FONT_FAMILY, ...systemFonts.value.map(aiConversationFontFamilyForName)]);
|
||||
if (editAiFontFamily.value) options.add(editAiFontFamily.value);
|
||||
return [...options];
|
||||
});
|
||||
|
||||
const uiFontOptions = computed(() => {
|
||||
const options = new Set([SYSTEM_UI_FONT_FAMILY, DEFAULT_UI_FONT_FAMILY, ...systemFontOptions.value]);
|
||||
if (editUiFontFamily.value) options.add(editUiFontFamily.value);
|
||||
@@ -1601,6 +1620,11 @@ function displayUiFontFamily(value: string): string {
|
||||
return displayFontFamily(value);
|
||||
}
|
||||
|
||||
function displayAiFontFamily(value: string): string {
|
||||
if (!value) return t("ai.conversationFontFollowInterface");
|
||||
return displayUiFontFamily(value);
|
||||
}
|
||||
|
||||
function fontOptionStyle(value: string, selectedValue = editFontFamily.value) {
|
||||
return isPresetFontFamily(value) || uiFontPreviewValues.has(value) || value === selectedValue ? { fontFamily: value } : undefined;
|
||||
}
|
||||
@@ -1630,6 +1654,8 @@ const hasImportedSettingsPendingApply = ref(false);
|
||||
function syncEditorSettingsDraftFromStore() {
|
||||
editFontFamily.value = settingsStore.editorSettings.fontFamily;
|
||||
editFontSize.value = settingsStore.editorSettings.fontSize;
|
||||
editAiFontFamily.value = settingsStore.editorSettings.aiFontFamily;
|
||||
editAiFontSize.value = settingsStore.editorSettings.aiFontSize;
|
||||
editTableFontFamily.value = settingsStore.editorSettings.tableFontFamily;
|
||||
editUiFontFamily.value = settingsStore.editorSettings.uiFontFamily;
|
||||
editUiScale.value = settingsStore.editorSettings.uiScale;
|
||||
@@ -2716,6 +2742,44 @@ function onUiFontFamilyChange(v: any) {
|
||||
}
|
||||
}
|
||||
|
||||
async function persistAiTypography(partial: Partial<Pick<EditorSettings, "aiFontFamily" | "aiFontSize">>) {
|
||||
aiTypographySaving.value = true;
|
||||
try {
|
||||
await settingsStore.updateEditorSettingsAndPersist(partial);
|
||||
} catch (error) {
|
||||
applySettingsErrorToast(error);
|
||||
} finally {
|
||||
editAiFontFamily.value = settingsStore.editorSettings.aiFontFamily;
|
||||
editAiFontSize.value = settingsStore.editorSettings.aiFontSize;
|
||||
aiTypographySaving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onAiFontFamilyChange(value: unknown) {
|
||||
const fontFamily = normalizeAiConversationFontFamily(value);
|
||||
editAiFontFamily.value = fontFamily;
|
||||
if (fontFamily !== settingsStore.editorSettings.aiFontFamily) void persistAiTypography({ aiFontFamily: fontFamily });
|
||||
}
|
||||
|
||||
function commitAiFontSize() {
|
||||
const fontSize = normalizeAiConversationFontSize(editAiFontSize.value);
|
||||
editAiFontSize.value = fontSize;
|
||||
if (fontSize !== settingsStore.editorSettings.aiFontSize) void persistAiTypography({ aiFontSize: fontSize });
|
||||
}
|
||||
|
||||
function blurAiFontSizeInput(event: KeyboardEvent) {
|
||||
(event.target as HTMLInputElement | null)?.blur();
|
||||
}
|
||||
|
||||
function resetAiTypography() {
|
||||
editAiFontFamily.value = AI_CONVERSATION_FONT_FAMILY_DEFAULT;
|
||||
editAiFontSize.value = AI_CONVERSATION_FONT_SIZE_DEFAULT;
|
||||
void persistAiTypography({
|
||||
aiFontFamily: AI_CONVERSATION_FONT_FAMILY_DEFAULT,
|
||||
aiFontSize: AI_CONVERSATION_FONT_SIZE_DEFAULT,
|
||||
});
|
||||
}
|
||||
|
||||
const themeSelectValue = computed(() => {
|
||||
if (editTheme.value === "custom") {
|
||||
return `custom:${editActiveCustomThemeId.value}`;
|
||||
@@ -3144,6 +3208,7 @@ async function revealSettingsSearchTarget(result: SettingsSearchEntry) {
|
||||
async function selectSettingsSearchResult(result: SettingsSearchEntry) {
|
||||
pendingSettingsSearchResult = result;
|
||||
if (result.shortcutId) shortcutSearchQuery.value = result.title;
|
||||
if (result.category === "ai") aiConfigListMode.value = "list";
|
||||
applySettingsSearchRoute(result);
|
||||
settingsSearchQuery.value = "";
|
||||
settingsSearchOpen.value = false;
|
||||
@@ -9241,6 +9306,80 @@ LIMIT 100;</pre
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="aiConfigListMode === 'list'" data-settings-search-id="ai-typography" class="space-y-3">
|
||||
<Separator />
|
||||
<div class="settings-item space-y-3 rounded-md border bg-muted/20 px-3 py-2">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="space-y-1">
|
||||
<h3 class="text-sm font-medium">{{ t("ai.conversationTypography") }}</h3>
|
||||
<p class="text-xs text-muted-foreground">{{ t("ai.conversationTypographyDescription") }}</p>
|
||||
</div>
|
||||
<Button type="button" size="sm" variant="ghost" class="h-7 shrink-0 gap-1 px-2 text-xs" :disabled="aiTypographySaving || (editAiFontFamily === AI_CONVERSATION_FONT_FAMILY_DEFAULT && Number(editAiFontSize) === AI_CONVERSATION_FONT_SIZE_DEFAULT)" @click="resetAiTypography">
|
||||
<RotateCcw class="h-3.5 w-3.5" />
|
||||
{{ t("settings.reset") }}
|
||||
</Button>
|
||||
</div>
|
||||
<div class="grid gap-3 sm:grid-cols-[minmax(0,1fr)_9rem]">
|
||||
<div class="min-w-0 space-y-1.5">
|
||||
<Label>{{ t("ai.conversationFontFamily") }}</Label>
|
||||
<SearchableSelect
|
||||
:model-value="editAiFontFamily"
|
||||
:options="aiFontOptions"
|
||||
:placeholder="t('ai.conversationFontFollowInterface')"
|
||||
:search-placeholder="t('settings.searchFont')"
|
||||
:empty-text="t('settings.noFontsFound')"
|
||||
:loading-text="t('settings.loadingFonts')"
|
||||
:disabled="aiTypographySaving"
|
||||
allow-custom
|
||||
clearable
|
||||
:display-name="displayAiFontFamily"
|
||||
:normalize-custom="normalizeAiConversationFontFamilyInput"
|
||||
:trigger-class="appearanceFontSearchTriggerClass"
|
||||
:trigger-icon-class="appearanceFontSearchTriggerIconClass"
|
||||
content-class="w-[var(--reka-popover-trigger-width)] min-w-[260px]"
|
||||
@update:model-value="onAiFontFamilyChange"
|
||||
@update:open="(open: boolean) => open && loadSystemFontOptions()"
|
||||
>
|
||||
<template #trigger-label="{ label, loading }">
|
||||
<span class="truncate" :style="editAiFontFamily ? { fontFamily: editAiFontFamily } : undefined">
|
||||
{{ loading ? t("settings.loadingFonts") : label }}
|
||||
</span>
|
||||
</template>
|
||||
<template #option-label="{ option, label }">
|
||||
<span class="truncate" :style="fontOptionStyle(option, editAiFontFamily)">{{ label }}</span>
|
||||
</template>
|
||||
<template #custom-option-label="{ value }">
|
||||
<span class="truncate" :style="{ fontFamily: value }">
|
||||
{{ t("settings.useCustomFont", { font: readableFontFamily(value) }) }}
|
||||
</span>
|
||||
</template>
|
||||
</SearchableSelect>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<Label for="ai-conversation-font-size">{{ t("ai.conversationFontSize") }}</Label>
|
||||
<div class="flex items-center gap-2">
|
||||
<Input
|
||||
id="ai-conversation-font-size"
|
||||
v-model.number="editAiFontSize"
|
||||
type="number"
|
||||
:min="AI_CONVERSATION_FONT_SIZE_MIN"
|
||||
:max="AI_CONVERSATION_FONT_SIZE_MAX"
|
||||
step="1"
|
||||
class="h-8 text-xs"
|
||||
:disabled="aiTypographySaving"
|
||||
@change="commitAiFontSize"
|
||||
@keydown.enter="blurAiFontSizeInput"
|
||||
/>
|
||||
<span class="text-xs text-muted-foreground">px</span>
|
||||
</div>
|
||||
<p class="text-[11px] text-muted-foreground">
|
||||
{{ t("ai.conversationFontSizeRange", { min: AI_CONVERSATION_FONT_SIZE_MIN, max: AI_CONVERSATION_FONT_SIZE_MAX }) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Agent Turn Limit (list mode, global) -->
|
||||
<div v-if="aiConfigListMode === 'list'" class="space-y-3">
|
||||
<Separator />
|
||||
|
||||
Reference in new issue
Block a user