feat: add privacy mode, thinking levels, PWA support, and i18n

- Add privacy mode to hide IP and user preferences from AI requests
- Add model thinking levels (low/medium/high) for context analysis depth
- Add PWA support with service worker, manifest, and app icons
- Add SettingsPanel for user preferences (theme, background, language)
- Add i18n translations for en/zh/ja/ko/de/fr
- Add Pinia store for centralized settings management
- Update backend to support user preferences and thinking levels
- Update config to use absolute API URLs
This commit is contained in:
2026-02-19 10:22:27 +08:00
parent d2b64ad5d6
commit aa6133e3ed
24 changed files with 1291 additions and 222 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

+14
View File
@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" width="192" height="192" viewBox="0 0 192 192">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#0f172a" />
<stop offset="100%" stop-color="#1d4ed8" />
</linearGradient>
</defs>
<rect width="192" height="192" rx="42" fill="url(#bg)" />
<rect x="42" y="44" width="108" height="104" rx="14" fill="#f8fafc" />
<rect x="57" y="66" width="78" height="8" rx="4" fill="#0f172a" />
<rect x="57" y="86" width="64" height="8" rx="4" fill="#334155" />
<rect x="57" y="106" width="48" height="8" rx="4" fill="#64748b" />
<rect x="57" y="126" width="60" height="8" rx="4" fill="#94a3b8" />
</svg>

After

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+14
View File
@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#0f172a" />
<stop offset="100%" stop-color="#1d4ed8" />
</linearGradient>
</defs>
<rect width="512" height="512" rx="110" fill="url(#bg)" />
<rect x="112" y="116" width="288" height="280" rx="36" fill="#f8fafc" />
<rect x="152" y="174" width="208" height="20" rx="10" fill="#0f172a" />
<rect x="152" y="224" width="172" height="20" rx="10" fill="#334155" />
<rect x="152" y="274" width="128" height="20" rx="10" fill="#64748b" />
<rect x="152" y="324" width="160" height="20" rx="10" fill="#94a3b8" />
</svg>

After

Width:  |  Height:  |  Size: 723 B

+14
View File
@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#0f172a" />
<stop offset="100%" stop-color="#1d4ed8" />
</linearGradient>
</defs>
<rect width="512" height="512" fill="url(#bg)" />
<rect x="126" y="132" width="260" height="248" rx="32" fill="#f8fafc" />
<rect x="162" y="184" width="188" height="18" rx="9" fill="#0f172a" />
<rect x="162" y="228" width="156" height="18" rx="9" fill="#334155" />
<rect x="162" y="272" width="116" height="18" rx="9" fill="#64748b" />
<rect x="162" y="316" width="144" height="18" rx="9" fill="#94a3b8" />
</svg>

After

Width:  |  Height:  |  Size: 710 B

+50
View File
@@ -0,0 +1,50 @@
{
"id": "/?source=pwa",
"name": "LLM in Text",
"short_name": "LLMText",
"description": "AI-assisted Markdown editor with real-time completion.",
"lang": "zh-CN",
"start_url": "/",
"scope": "/",
"display": "standalone",
"display_override": [
"window-controls-overlay",
"standalone",
"minimal-ui"
],
"orientation": "any",
"background_color": "#f8fafc",
"theme_color": "#0f172a",
"categories": [
"productivity",
"utilities"
],
"icons": [
{
"src": "/icons/icon-192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icons/icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/icons/icon-512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"shortcuts": [
{
"name": "New Draft",
"short_name": "Draft",
"description": "Open the editor to start writing immediately.",
"url": "/"
}
]
}
+79
View File
@@ -0,0 +1,79 @@
const CACHE_NAME = 'llm-in-text-v1';
const APP_SHELL_ASSETS = [
'/',
'/index.html',
'/manifest.webmanifest',
'/icons/icon-180.png',
'/icons/icon-192.png',
'/icons/icon-512.png'
];
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => cache.addAll(APP_SHELL_ASSETS))
);
self.skipWaiting();
});
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys().then((keys) =>
Promise.all(
keys
.filter((key) => key !== CACHE_NAME)
.map((key) => caches.delete(key))
)
)
);
self.clients.claim();
});
async function staleWhileRevalidate(request) {
const cache = await caches.open(CACHE_NAME);
const cached = await cache.match(request);
const networkPromise = fetch(request)
.then((response) => {
if (response.ok) {
cache.put(request, response.clone());
}
return response;
})
.catch(() => cached);
return cached || networkPromise;
}
self.addEventListener('fetch', (event) => {
const { request } = event;
if (request.method !== 'GET') return;
const url = new URL(request.url);
if (url.origin !== self.location.origin) return;
if (url.pathname.startsWith('/v1/')) return;
if (request.mode === 'navigate') {
event.respondWith(
fetch(request)
.then((response) => {
if (response.ok) {
const copy = response.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(request, copy));
}
return response;
})
.catch(async () => {
const cachedPage = await caches.match(request);
if (cachedPage) return cachedPage;
return caches.match('/index.html');
})
);
return;
}
const cacheableDestinations = ['script', 'style', 'font', 'image', 'worker'];
if (cacheableDestinations.includes(request.destination)) {
event.respondWith(staleWhileRevalidate(request));
}
});