feat: add configurable chat font size setting

This commit is contained in:
Eohan G. 2026-02-15 00:06:34 +08:00
parent 2a2f75d2e1
commit 846739fec8
6 changed files with 63 additions and 25 deletions

View file

@ -1,11 +0,0 @@
{
"id": "agent-client",
"name": "Agent Client",
"version": "0.7.5",
"minAppVersion": "0.15.0",
"description": "Chat with AI agents via the Agent Client Protocol directly from your vault.",
"author": "RAIT-09",
"authorUrl": "https://github.com/RAIT-09",
"fundingUrl": "https://www.buymeacoffee.com/rait09",
"isDesktopOnly": true
}

32
package-lock.json generated
View file

@ -428,8 +428,10 @@
"version": "18.3.27",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.27.tgz",
"integrity": "sha512-cisd7gxkzjBKU2GgdYrTdtQx1SORymWyaAFhaxQPK9bYO9ot3Y5OikQRvY0VYQtvwjeQnizCINJAenh/V7MK2w==",
"extraneous": true,
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"@types/prop-types": "*",
"csstype": "^3.2.2"
@ -439,8 +441,10 @@
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
"extraneous": true,
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"loose-envify": "^1.1.0"
},
@ -452,8 +456,10 @@
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
"extraneous": true,
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"loose-envify": "^1.1.0",
"scheduler": "^0.23.2"
@ -466,8 +472,10 @@
"version": "0.23.2",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
"integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
"extraneous": true,
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"loose-envify": "^1.1.0"
}
@ -1745,8 +1753,10 @@
"version": "15.7.15",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
"integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==",
"extraneous": true,
"license": "MIT"
"dev": true,
"license": "MIT",
"optional": true,
"peer": true
},
"node_modules/@types/react": {
"version": "19.2.10",
@ -7243,8 +7253,10 @@
"version": "25.1.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.1.0.tgz",
"integrity": "sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA==",
"extraneous": true,
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
@ -7306,8 +7318,10 @@
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
"extraneous": true,
"license": "MIT"
"dev": true,
"license": "MIT",
"optional": true,
"peer": true
},
"node_modules/vitepress/node_modules/vite": {
"version": "5.4.21",

View file

@ -1112,7 +1112,14 @@ function ChatComponent({
// Render
// ============================================================
return (
<div className="agent-client-chat-view-container">
<div
className="agent-client-chat-view-container"
style={
{
"--ac-chat-font-size": `${settings.displaySettings.fontSize}px`,
} as React.CSSProperties
}
>
<ChatHeader
agentLabel={activeAgentLabel}
isUpdateAvailable={isUpdateAvailable}

View file

@ -187,6 +187,24 @@ export class AgentClientSettingTab extends PluginSettingTab {
}),
);
new Setting(containerEl)
.setName("Chat font size")
.setDesc("Adjust the font size of the chat message area (px).")
.addText((text) =>
text
.setPlaceholder("12")
.setValue(
String(this.plugin.settings.displaySettings.fontSize),
)
.onChange(async (value) => {
const num = parseInt(value, 10);
if (!isNaN(num) && num >= 8) {
this.plugin.settings.displaySettings.fontSize = num;
await this.plugin.saveSettings();
}
}),
);
new Setting(containerEl)
.setName("Show emojis")
.setDesc(

View file

@ -77,6 +77,7 @@ export interface AgentClientPluginSettings {
maxNoteLength: number;
maxSelectionLength: number;
showEmojis: boolean;
fontSize: number;
};
// Locally saved session metadata (for agents without session/list support)
savedSessions: SavedSessionInfo[];
@ -134,6 +135,7 @@ const DEFAULT_SETTINGS: AgentClientPluginSettings = {
maxNoteLength: 10000,
maxSelectionLength: 10000,
showEmojis: true,
fontSize: 12,
},
savedSessions: [],
};
@ -907,6 +909,12 @@ export default class AgentClientPlugin extends Plugin {
typeof rawDisplay.showEmojis === "boolean"
? rawDisplay.showEmojis
: DEFAULT_SETTINGS.displaySettings.showEmojis,
fontSize:
typeof rawDisplay.fontSize === "number" &&
rawDisplay.fontSize >= 10 &&
rawDisplay.fontSize <= 24
? rawDisplay.fontSize
: DEFAULT_SETTINGS.displaySettings.fontSize,
};
}
return DEFAULT_SETTINGS.displaySettings;

View file

@ -153,7 +153,7 @@ If your plugin does not need CSS, delete this file.
background-color: transparent;
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
font-size: 12px;
font-size: 0.85em;
user-select: text;
overflow-wrap: break-word;
word-wrap: break-word;
@ -389,6 +389,7 @@ If your plugin does not need CSS, delete this file.
/* Main container */
.agent-client-chat-view-container {
--ac-chat-font-size: 12px;
height: 100%;
display: flex;
flex-direction: column;
@ -440,6 +441,7 @@ If your plugin does not need CSS, delete this file.
display: flex;
flex-direction: column;
gap: 2px;
font-size: var(--ac-chat-font-size);
}
/* Allow horizontal scroll for wide tables within messages */
@ -696,7 +698,7 @@ If your plugin does not need CSS, delete this file.
min-height: 80px;
max-height: 300px;
font-family: inherit;
font-size: var(--font-text-size);
font-size: var(--ac-chat-font-size);
line-height: var(--line-height-normal);
box-sizing: border-box;
outline: none;
@ -1121,7 +1123,7 @@ If your plugin does not need CSS, delete this file.
word-break: break-word;
overflow-wrap: break-word;
margin: 1em 0;
font-size: var(--font-text-size);
font-size: var(--ac-chat-font-size);
max-width: 100%;
}
@ -1137,7 +1139,7 @@ If your plugin does not need CSS, delete this file.
/* Markdown Text Renderer */
.agent-client-markdown-text-renderer {
user-select: text;
font-size: var(--font-text-size);
font-size: var(--ac-chat-font-size);
overflow-wrap: break-word;
word-wrap: break-word;
word-break: break-word;