Feature/lmstudio provider (#30)
* chore: just a plan update * Add LM Studio as local AI provider (OpenAI-compatible, like Ollama) * Convert WebP thumbnails to JPEG before image analysis for LM Studio compatibility * Strengthen language enforcement in image analysis prompt for local models * Use i18n localized prompts for image analysis instead of English instructions * Add airplane mode (Flugmodus) with status bar toggle and offline model preferences * Fix flightmode: persist model IDs, skip network when offline, airplane icon * Auto-fallback to offline models in airplane mode for chat, title, and image analysis * Auto-select first local model as offline fallback when no explicit offline model configured * Block git fetch/pull/push and site upload in airplane mode * fix: thumbnails optimized for AI * fix: error handling in airplane mode --------- Co-authored-by: hugo <hugoms@me.com>
This commit is contained in:
@@ -129,7 +129,7 @@ export interface GitLfsPruneResult {
|
||||
|
||||
export interface GitActionResult {
|
||||
success: boolean;
|
||||
code?: 'auth-required' | 'conflict' | 'network' | 'action-failed';
|
||||
code?: 'auth-required' | 'conflict' | 'network' | 'action-failed' | 'offline';
|
||||
error?: string;
|
||||
guidance?: string[];
|
||||
}
|
||||
|
||||
@@ -10,11 +10,12 @@ import { media, Media, NewMedia, postMedia } from '../database/schema';
|
||||
import { stemText, stemQuery, SupportedLanguage } from './stemmer';
|
||||
import { CliNotifier, NoopNotifier } from './CliNotifier';
|
||||
|
||||
// Thumbnail sizes
|
||||
// Thumbnail sizes — 'ai' is a dedicated JPEG thumbnail for vision-model input
|
||||
const THUMBNAIL_SIZES = {
|
||||
small: { width: 150, height: 150 },
|
||||
medium: { width: 400, height: 400 },
|
||||
large: { width: 800, height: 800 },
|
||||
small: { width: 150, height: 150, ext: 'webp' as const, mime: 'image/webp' as const },
|
||||
medium: { width: 400, height: 400, ext: 'webp' as const, mime: 'image/webp' as const },
|
||||
large: { width: 800, height: 800, ext: 'webp' as const, mime: 'image/webp' as const },
|
||||
ai: { width: 448, height: 448, ext: 'jpg' as const, mime: 'image/jpeg' as const },
|
||||
} as const;
|
||||
|
||||
type ThumbnailSize = keyof typeof THUMBNAIL_SIZES;
|
||||
@@ -244,17 +245,26 @@ export class MediaEngine extends EventEmitter {
|
||||
// Dynamic import of sharp (it's a native module)
|
||||
const sharp = (await import('sharp')).default;
|
||||
|
||||
for (const [size, dimensions] of Object.entries(THUMBNAIL_SIZES) as [ThumbnailSize, { width: number; height: number }][]) {
|
||||
const thumbnailPath = path.join(thumbnailSubDir, `${mediaId}-${size}.webp`);
|
||||
for (const [size, config] of Object.entries(THUMBNAIL_SIZES) as [ThumbnailSize, (typeof THUMBNAIL_SIZES)[ThumbnailSize]][]) {
|
||||
const thumbnailPath = path.join(thumbnailSubDir, `${mediaId}-${size}.${config.ext}`);
|
||||
|
||||
await sharp(sourcePath)
|
||||
.resize(dimensions.width, dimensions.height, {
|
||||
fit: 'inside',
|
||||
withoutEnlargement: true,
|
||||
})
|
||||
.webp({ quality: 80 })
|
||||
.toFile(thumbnailPath);
|
||||
// AI thumbnail: exact 448×448 with black letterboxing for vision models.
|
||||
// All others: fit inside bounding box, no upscaling.
|
||||
const isAI = size === 'ai';
|
||||
let pipeline = sharp(sourcePath)
|
||||
.resize(config.width, config.height, {
|
||||
fit: isAI ? 'contain' : 'inside',
|
||||
withoutEnlargement: !isAI,
|
||||
background: { r: 0, g: 0, b: 0 },
|
||||
});
|
||||
|
||||
if (config.ext === 'jpg') {
|
||||
pipeline = pipeline.jpeg({ quality: 85 });
|
||||
} else {
|
||||
pipeline = pipeline.webp({ quality: 80 });
|
||||
}
|
||||
|
||||
await pipeline.toFile(thumbnailPath);
|
||||
thumbnails[size] = thumbnailPath;
|
||||
}
|
||||
|
||||
@@ -276,10 +286,11 @@ export class MediaEngine extends EventEmitter {
|
||||
small: null,
|
||||
medium: null,
|
||||
large: null,
|
||||
ai: null,
|
||||
};
|
||||
|
||||
for (const size of Object.keys(THUMBNAIL_SIZES) as ThumbnailSize[]) {
|
||||
const thumbnailPath = path.join(thumbnailSubDir, `${mediaId}-${size}.webp`);
|
||||
const thumbnailPath = path.join(thumbnailSubDir, `${mediaId}-${size}.${THUMBNAIL_SIZES[size].ext}`);
|
||||
try {
|
||||
await fs.access(thumbnailPath);
|
||||
result[size] = thumbnailPath;
|
||||
@@ -296,11 +307,12 @@ export class MediaEngine extends EventEmitter {
|
||||
*/
|
||||
async getThumbnailDataUrl(mediaId: string, size: ThumbnailSize = 'small'): Promise<string | null> {
|
||||
const thumbnailSubDir = this.getThumbnailSubDir(mediaId);
|
||||
const thumbnailPath = path.join(thumbnailSubDir, `${mediaId}-${size}.webp`);
|
||||
const config = THUMBNAIL_SIZES[size];
|
||||
const thumbnailPath = path.join(thumbnailSubDir, `${mediaId}-${size}.${config.ext}`);
|
||||
|
||||
try {
|
||||
const data = await fs.readFile(thumbnailPath);
|
||||
return `data:image/webp;base64,${data.toString('base64')}`;
|
||||
return `data:${config.mime};base64,${data.toString('base64')}`;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
@@ -313,7 +325,7 @@ export class MediaEngine extends EventEmitter {
|
||||
const thumbnailSubDir = this.getThumbnailSubDir(mediaId);
|
||||
|
||||
for (const size of Object.keys(THUMBNAIL_SIZES) as ThumbnailSize[]) {
|
||||
const thumbnailPath = path.join(thumbnailSubDir, `${mediaId}-${size}.webp`);
|
||||
const thumbnailPath = path.join(thumbnailSubDir, `${mediaId}-${size}.${THUMBNAIL_SIZES[size].ext}`);
|
||||
try {
|
||||
await fs.unlink(thumbnailPath);
|
||||
} catch {
|
||||
@@ -1166,7 +1178,7 @@ export class MediaEngine extends EventEmitter {
|
||||
for (const item of imageMedia) {
|
||||
const thumbnails = await this.getThumbnailPaths(item.id);
|
||||
// Consider missing if any size is missing
|
||||
if (!thumbnails.small || !thumbnails.medium || !thumbnails.large) {
|
||||
if (!thumbnails.small || !thumbnails.medium || !thumbnails.large || !thumbnails.ai) {
|
||||
missingThumbnails.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,21 @@ export class ChatService {
|
||||
const abortController = new AbortController();
|
||||
this.abortControllers.set(conversationId, abortController);
|
||||
|
||||
const modelId = conversation.model || 'claude-sonnet-4';
|
||||
let modelId = conversation.model || 'claude-sonnet-4';
|
||||
|
||||
// In offline mode, swap to the configured offline chat model
|
||||
if (this.providers.isOfflineMode()) {
|
||||
if (!this.providers.isOllamaModel(modelId) && !this.providers.isLmstudioModel(modelId)) {
|
||||
const offlineModel = await this.chatEngine.getSetting('offline_chat_model')
|
||||
|| this.providers.getFirstKnownLocalModelId();
|
||||
if (offlineModel) {
|
||||
modelId = offlineModel;
|
||||
} else {
|
||||
return { success: false, error: 'No offline chat model configured. Set one in Settings → AI → Airplane Mode.' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const provider = this.providers.detectModelProvider(modelId);
|
||||
|
||||
// Verify provider key is available
|
||||
@@ -271,9 +285,11 @@ export class ChatService {
|
||||
|
||||
const aiMessages = dbMessagesToAIMessages(dbMessages);
|
||||
|
||||
// Build tools (skip for Ollama models unless capability override is set)
|
||||
// Build tools (skip for Ollama/LM Studio models unless capability override is set)
|
||||
const isOllama = this.providers.isOllamaModel(modelId);
|
||||
const skipTools = isOllama && !this.providers.ollamaModelSupportsTools(modelId);
|
||||
const isLmstudio = this.providers.isLmstudioModel(modelId);
|
||||
const skipTools = (isOllama && !this.providers.ollamaModelSupportsTools(modelId))
|
||||
|| (isLmstudio && !this.providers.lmstudioModelSupportsTools(modelId));
|
||||
const blogTools = skipTools ? {} : createBlogTools(this.blogToolDeps);
|
||||
const a2uiToolsRaw = skipTools ? {} : createA2UITools();
|
||||
const allTools = { ...blogTools, ...a2uiToolsRaw };
|
||||
@@ -447,6 +463,18 @@ export class ChatService {
|
||||
? 'mistral-small-latest'
|
||||
: null;
|
||||
}
|
||||
|
||||
// In offline mode, swap to the configured offline title model
|
||||
if (this.providers.isOfflineMode()) {
|
||||
const offlineModel = await this.chatEngine.getSetting('offline_title_model')
|
||||
|| this.providers.getFirstKnownLocalModelId();
|
||||
if (offlineModel) {
|
||||
titleModel = offlineModel;
|
||||
} else if (!titleModel || (!this.providers.isOllamaModel(titleModel) && !this.providers.isLmstudioModel(titleModel))) {
|
||||
return; // No offline title model — skip title generation silently
|
||||
}
|
||||
}
|
||||
|
||||
if (!titleModel) return;
|
||||
|
||||
const model = this.providers.resolveModel(titleModel);
|
||||
|
||||
@@ -29,9 +29,12 @@ export const ZEN_MODELS_URL = 'https://opencode.ai/zen/v1/models';
|
||||
export const MISTRAL_MODELS_URL = 'https://api.mistral.ai/v1/models';
|
||||
export const OLLAMA_BASE_URL = 'http://localhost:11434/v1';
|
||||
export const OLLAMA_TAGS_URL = 'http://localhost:11434/api/tags';
|
||||
export const LMSTUDIO_BASE_URL = 'http://localhost:1234/v1';
|
||||
export const LMSTUDIO_MODELS_URL = 'http://localhost:1234/v1/models';
|
||||
|
||||
const MODEL_CACHE_TTL = 5 * 60 * 1000; // 5 minutes
|
||||
const OLLAMA_FETCH_TIMEOUT = 3000; // 3 s — fail fast when Ollama isn't running
|
||||
const LMSTUDIO_FETCH_TIMEOUT = 3000; // 3 s — fail fast when LM Studio isn't running
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Gateway factory
|
||||
@@ -108,12 +111,28 @@ export class ProviderRegistry {
|
||||
private ollamaProvider: ReturnType<typeof createOpenAI> | null = null;
|
||||
private ollamaModelIds = new Set<string>();
|
||||
private ollamaCapabilities = new Map<string, { tools: boolean; vision: boolean }>();
|
||||
private lmstudioEnabled = false;
|
||||
private lmstudioProvider: ReturnType<typeof createOpenAI> | null = null;
|
||||
private lmstudioModelIds = new Set<string>();
|
||||
private lmstudioCapabilities = new Map<string, { tools: boolean; vision: boolean }>();
|
||||
private modelCatalogEngine = new ModelCatalogEngine();
|
||||
private _offlineMode = false;
|
||||
|
||||
// Model cache
|
||||
private cachedModels: ChatModel[] | null = null;
|
||||
private cachedModelsAt = 0;
|
||||
|
||||
// ---- Offline / airplane mode ----
|
||||
|
||||
setOfflineMode(enabled: boolean): void {
|
||||
this._offlineMode = enabled;
|
||||
this.invalidateModelCache();
|
||||
}
|
||||
|
||||
isOfflineMode(): boolean {
|
||||
return this._offlineMode;
|
||||
}
|
||||
|
||||
// ---- Key management ----
|
||||
|
||||
setOpencodeKey(key: string): void {
|
||||
@@ -203,33 +222,109 @@ export class ProviderRegistry {
|
||||
return this.ollamaCapabilities.get(modelId)?.vision ?? false;
|
||||
}
|
||||
|
||||
// ---- LM Studio management ----
|
||||
|
||||
setLmstudioEnabled(enabled: boolean): void {
|
||||
this.lmstudioEnabled = enabled;
|
||||
this.lmstudioProvider = null;
|
||||
this.invalidateModelCache();
|
||||
}
|
||||
|
||||
isLmstudioEnabled(): boolean {
|
||||
return this.lmstudioEnabled;
|
||||
}
|
||||
|
||||
/** Register a model ID as belonging to LM Studio. */
|
||||
registerLmstudioModel(modelId: string): void {
|
||||
this.lmstudioModelIds.add(modelId);
|
||||
}
|
||||
|
||||
/** Check whether a model ID was registered as an LM Studio model. */
|
||||
isLmstudioModel(modelId: string): boolean {
|
||||
return this.lmstudioModelIds.has(modelId);
|
||||
}
|
||||
|
||||
/** Remove all registered LM Studio model IDs. */
|
||||
clearLmstudioModels(): void {
|
||||
this.lmstudioModelIds.clear();
|
||||
}
|
||||
|
||||
// ---- LM Studio model capability overrides ----
|
||||
|
||||
/** Get capability overrides for a specific LM Studio model (defaults to tools=false, vision=false). */
|
||||
getLmstudioModelCapabilities(modelId: string): { tools: boolean; vision: boolean } {
|
||||
return this.lmstudioCapabilities.get(modelId) ?? { tools: false, vision: false };
|
||||
}
|
||||
|
||||
/** Set capability overrides for a specific LM Studio model. */
|
||||
setLmstudioModelCapabilities(modelId: string, caps: { tools: boolean; vision: boolean }): void {
|
||||
this.lmstudioCapabilities.set(modelId, caps);
|
||||
this.invalidateModelCache();
|
||||
}
|
||||
|
||||
/** Get all stored LM Studio capability overrides as a plain object. */
|
||||
getAllLmstudioModelCapabilities(): Record<string, { tools: boolean; vision: boolean }> {
|
||||
const result: Record<string, { tools: boolean; vision: boolean }> = {};
|
||||
for (const [id, caps] of this.lmstudioCapabilities) {
|
||||
result[id] = caps;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Load LM Studio capability overrides from a serialized object (e.g. from settings DB). */
|
||||
loadLmstudioModelCapabilities(data: Record<string, { tools: boolean; vision: boolean }>): void {
|
||||
this.lmstudioCapabilities.clear();
|
||||
for (const [id, caps] of Object.entries(data)) {
|
||||
this.lmstudioCapabilities.set(id, caps);
|
||||
}
|
||||
}
|
||||
|
||||
/** Check whether an LM Studio model has tools capability enabled. */
|
||||
lmstudioModelSupportsTools(modelId: string): boolean {
|
||||
return this.lmstudioCapabilities.get(modelId)?.tools ?? false;
|
||||
}
|
||||
|
||||
/** Check whether an LM Studio model has vision capability enabled. */
|
||||
lmstudioModelSupportsVision(modelId: string): boolean {
|
||||
return this.lmstudioCapabilities.get(modelId)?.vision ?? false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect the effective provider for a model ID, checking Ollama
|
||||
* Detect the effective provider for a model ID, checking Ollama and LM Studio
|
||||
* registration first, then falling back to prefix-based detection.
|
||||
*/
|
||||
detectModelProvider(modelId: string): string {
|
||||
if (this.ollamaModelIds.has(modelId)) return 'ollama';
|
||||
if (this.lmstudioModelIds.has(modelId)) return 'lmstudio';
|
||||
return detectProvider(modelId);
|
||||
}
|
||||
|
||||
/** Check whether at least one provider key is configured. */
|
||||
isReady(): boolean {
|
||||
return !!(this.opencodeKey || this.mistralKey || this.ollamaEnabled);
|
||||
if (this._offlineMode) {
|
||||
return !!(this.ollamaEnabled || this.lmstudioEnabled);
|
||||
}
|
||||
return !!(this.opencodeKey || this.mistralKey || this.ollamaEnabled || this.lmstudioEnabled);
|
||||
}
|
||||
|
||||
/** Check whether the key for a specific provider is set. */
|
||||
isProviderKeySet(provider: string): boolean {
|
||||
if (provider === 'mistral') return !!this.mistralKey;
|
||||
if (provider === 'ollama') return this.ollamaEnabled;
|
||||
if (provider === 'lmstudio') return this.lmstudioEnabled;
|
||||
// In offline mode, cloud providers are unavailable
|
||||
if (this._offlineMode) return false;
|
||||
if (provider === 'mistral') return !!this.mistralKey;
|
||||
return !!this.opencodeKey;
|
||||
}
|
||||
|
||||
/** Returns status of all configured providers. */
|
||||
getProviderStatus(): { opencode: boolean; mistral: boolean; ollama: boolean } {
|
||||
getProviderStatus(): { opencode: boolean; mistral: boolean; ollama: boolean; lmstudio: boolean; offlineMode: boolean } {
|
||||
return {
|
||||
opencode: !!this.opencodeKey,
|
||||
mistral: !!this.mistralKey,
|
||||
ollama: this.ollamaEnabled,
|
||||
lmstudio: this.lmstudioEnabled,
|
||||
offlineMode: this._offlineMode,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -237,6 +332,11 @@ export class ProviderRegistry {
|
||||
|
||||
/** Resolve a model ID to an AI SDK LanguageModel. */
|
||||
resolveModel(modelId: string): LanguageModel {
|
||||
// In offline mode, only local providers are allowed
|
||||
if (this._offlineMode && !this.ollamaModelIds.has(modelId) && !this.lmstudioModelIds.has(modelId)) {
|
||||
throw new Error(`Model '${modelId}' is not available offline. Switch to a local model or disable airplane mode.`);
|
||||
}
|
||||
|
||||
// Check if this is a registered Ollama model first
|
||||
if (this.ollamaModelIds.has(modelId)) {
|
||||
if (!this.ollamaEnabled) {
|
||||
@@ -251,6 +351,20 @@ export class ProviderRegistry {
|
||||
return this.ollamaProvider.chat(modelId);
|
||||
}
|
||||
|
||||
// Check if this is a registered LM Studio model
|
||||
if (this.lmstudioModelIds.has(modelId)) {
|
||||
if (!this.lmstudioEnabled) {
|
||||
throw new Error(`LM Studio not configured for model '${modelId}'`);
|
||||
}
|
||||
if (!this.lmstudioProvider) {
|
||||
this.lmstudioProvider = createOpenAI({
|
||||
baseURL: LMSTUDIO_BASE_URL,
|
||||
apiKey: 'lm-studio', // LM Studio doesn't need a real key
|
||||
});
|
||||
}
|
||||
return this.lmstudioProvider.chat(modelId);
|
||||
}
|
||||
|
||||
const provider = detectProvider(modelId);
|
||||
|
||||
if (provider === 'mistral') {
|
||||
@@ -285,18 +399,66 @@ export class ProviderRegistry {
|
||||
return this.modelCatalogEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first known local model ID, or null if none registered.
|
||||
* Used as automatic fallback when no explicit offline model is configured.
|
||||
*/
|
||||
getFirstKnownLocalModelId(): string | null {
|
||||
for (const id of this.ollamaModelIds) return id;
|
||||
for (const id of this.lmstudioModelIds) return id;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first known local vision-capable model ID, or null.
|
||||
*/
|
||||
getFirstKnownLocalVisionModelId(): string | null {
|
||||
for (const id of this.ollamaModelIds) {
|
||||
if (this.ollamaModelSupportsVision(id)) return id;
|
||||
}
|
||||
for (const id of this.lmstudioModelIds) {
|
||||
if (this.lmstudioModelSupportsVision(id)) return id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return models already known to belong to local providers (Ollama + LM Studio)
|
||||
* from in-memory sets, without any network fetch.
|
||||
*/
|
||||
getKnownLocalModels(): ChatModel[] {
|
||||
const models: ChatModel[] = [];
|
||||
for (const id of this.ollamaModelIds) {
|
||||
models.push({ id, name: id, provider: 'ollama', vision: this.ollamaModelSupportsVision(id) });
|
||||
}
|
||||
for (const id of this.lmstudioModelIds) {
|
||||
models.push({ id, name: id, provider: 'lmstudio', vision: this.lmstudioModelSupportsVision(id) });
|
||||
}
|
||||
return models;
|
||||
}
|
||||
|
||||
/** Get available models across all configured providers (cached 5 min). */
|
||||
async getAvailableModels(): Promise<ChatModel[]> {
|
||||
if (this.cachedModels && Date.now() - this.cachedModelsAt < MODEL_CACHE_TTL) {
|
||||
return this.cachedModels;
|
||||
}
|
||||
|
||||
// In offline mode, return known local models instantly — no network.
|
||||
if (this._offlineMode) {
|
||||
const local = this.getKnownLocalModels();
|
||||
if (local.length > 0) {
|
||||
this.cachedModels = local;
|
||||
this.cachedModelsAt = Date.now();
|
||||
}
|
||||
return local;
|
||||
}
|
||||
|
||||
const allModels: ChatModel[] = [];
|
||||
let fetched = false;
|
||||
const { vision: catalogVision, names: catalogNames } = await this.getCatalogLookups();
|
||||
|
||||
// Fetch OpenCode models
|
||||
if (this.opencodeKey) {
|
||||
// Fetch OpenCode models (skip in offline mode)
|
||||
if (this.opencodeKey && !this._offlineMode) {
|
||||
try {
|
||||
const models = await this.fetchModelsFromEndpoint(
|
||||
ZEN_MODELS_URL,
|
||||
@@ -311,8 +473,8 @@ export class ProviderRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch Mistral models
|
||||
if (this.mistralKey) {
|
||||
// Fetch Mistral models (skip in offline mode)
|
||||
if (this.mistralKey && !this._offlineMode) {
|
||||
try {
|
||||
const models = await this.fetchModelsFromEndpoint(
|
||||
MISTRAL_MODELS_URL,
|
||||
@@ -339,6 +501,17 @@ export class ProviderRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch LM Studio models
|
||||
if (this.lmstudioEnabled) {
|
||||
try {
|
||||
const models = await this.fetchLmstudioModels();
|
||||
allModels.push(...models);
|
||||
if (models.length > 0) fetched = true;
|
||||
} catch {
|
||||
// LM Studio not running — skip silently
|
||||
}
|
||||
}
|
||||
|
||||
if (fetched && allModels.length > 0) {
|
||||
this.cachedModels = allModels;
|
||||
this.cachedModelsAt = Date.now();
|
||||
@@ -393,6 +566,38 @@ export class ProviderRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
// ---- LM Studio model listing ----
|
||||
|
||||
/**
|
||||
* Fetch available models from LM Studio's OpenAI-compatible /v1/models endpoint.
|
||||
* Returns ChatModel[] and registers the model IDs internally.
|
||||
*/
|
||||
async fetchLmstudioModels(): Promise<ChatModel[]> {
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), LMSTUDIO_FETCH_TIMEOUT);
|
||||
const response = await fetch(LMSTUDIO_MODELS_URL, { method: 'GET', signal: controller.signal });
|
||||
clearTimeout(timeout);
|
||||
if (!response.ok) return [];
|
||||
|
||||
const data = await response.json() as { data?: Array<{ id: string }> };
|
||||
if (!data.data || !Array.isArray(data.data)) return [];
|
||||
|
||||
const models: ChatModel[] = data.data.map(m => ({
|
||||
id: m.id,
|
||||
name: m.id,
|
||||
provider: 'lmstudio',
|
||||
vision: this.lmstudioModelSupportsVision(m.id),
|
||||
}));
|
||||
// Only replace registered IDs on successful fetch
|
||||
this.clearLmstudioModels();
|
||||
for (const m of models) this.registerLmstudioModel(m.id);
|
||||
return models;
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Ollama model listing ----
|
||||
|
||||
/**
|
||||
@@ -410,16 +615,15 @@ export class ProviderRegistry {
|
||||
const data = await response.json() as { models?: Array<{ name: string; details?: { family?: string } }> };
|
||||
if (!data.models || !Array.isArray(data.models)) return [];
|
||||
|
||||
const models: ChatModel[] = data.models.map(m => ({
|
||||
id: m.name,
|
||||
name: m.name,
|
||||
provider: 'ollama',
|
||||
vision: this.ollamaModelSupportsVision(m.name),
|
||||
}));
|
||||
// Only replace registered IDs on successful fetch
|
||||
this.clearOllamaModels();
|
||||
const models: ChatModel[] = data.models.map(m => {
|
||||
this.registerOllamaModel(m.name);
|
||||
return {
|
||||
id: m.name,
|
||||
name: m.name,
|
||||
provider: 'ollama',
|
||||
vision: this.ollamaModelSupportsVision(m.name),
|
||||
};
|
||||
});
|
||||
for (const m of models) this.registerOllamaModel(m.id);
|
||||
return models;
|
||||
} catch {
|
||||
return [];
|
||||
|
||||
@@ -9,6 +9,7 @@ import { generateText } from 'ai';
|
||||
import type { ChatEngine } from '../ChatEngine';
|
||||
import type { MediaEngine } from '../MediaEngine';
|
||||
import { ProviderRegistry } from './providers';
|
||||
import { resolveSupportedRenderLanguage, translateRender } from '../../shared/i18n';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Types
|
||||
@@ -29,17 +30,6 @@ export interface ImageAnalysisResult {
|
||||
error?: string;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Language map for image analysis prompts
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const LANGUAGE_NAMES: Record<string, string> = {
|
||||
en: 'English', de: 'German', es: 'Spanish', fr: 'French', it: 'Italian',
|
||||
pt: 'Portuguese', nl: 'Dutch', pl: 'Polish', ru: 'Russian', ja: 'Japanese',
|
||||
zh: 'Chinese', ko: 'Korean', ar: 'Arabic', hi: 'Hindi', tr: 'Turkish',
|
||||
sv: 'Swedish', da: 'Danish', no: 'Norwegian', fi: 'Finnish', cs: 'Czech',
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// OneShotTasks
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -70,7 +60,7 @@ export class OneShotTasks {
|
||||
): Promise<TaxonomyAnalysisResult> {
|
||||
const provider = this.providers.detectModelProvider(modelId);
|
||||
if (!this.providers.isProviderKeySet(provider)) {
|
||||
const providerLabel = provider === 'mistral' ? 'Mistral' : provider === 'ollama' ? 'Ollama' : 'OpenCode';
|
||||
const providerLabel = provider === 'mistral' ? 'Mistral' : provider === 'ollama' ? 'Ollama' : provider === 'lmstudio' ? 'LM Studio' : 'OpenCode';
|
||||
return { success: false, error: `${providerLabel} API key not set` };
|
||||
}
|
||||
|
||||
@@ -194,6 +184,19 @@ Remember: Only suggest mappings from NEW items to EXISTING items. Consider langu
|
||||
? 'mistral-large-latest'
|
||||
: null;
|
||||
}
|
||||
|
||||
// In offline mode, swap to the configured offline image analysis model
|
||||
if (this.providers.isOfflineMode()) {
|
||||
const offlineModel = await this.chatEngine.getSetting('offline_image_analysis_model')
|
||||
|| this.providers.getFirstKnownLocalVisionModelId()
|
||||
|| this.providers.getFirstKnownLocalModelId();
|
||||
if (offlineModel) {
|
||||
modelId = offlineModel;
|
||||
} else if (!modelId || (!this.providers.isOllamaModel(modelId) && !this.providers.isLmstudioModel(modelId))) {
|
||||
return { success: false, error: 'No offline image analysis model configured. Set one in Settings → AI → Airplane Mode.' };
|
||||
}
|
||||
}
|
||||
|
||||
if (!modelId) {
|
||||
return { success: false, error: 'API key not configured. Please set an API key in Settings.' };
|
||||
}
|
||||
@@ -205,23 +208,40 @@ Remember: Only suggest mappings from NEW items to EXISTING items. Consider langu
|
||||
return { success: false, error: `Cannot analyze this file type: ${mediaItem.mimeType}. Only images are supported.` };
|
||||
}
|
||||
|
||||
// Get thumbnail
|
||||
let dataUrl = await this.mediaEngine.getThumbnailDataUrl(mediaId, 'large');
|
||||
if (!dataUrl) dataUrl = await this.mediaEngine.getThumbnailDataUrl(mediaId, 'medium');
|
||||
// Get AI-optimised JPEG thumbnail (512px, pre-generated).
|
||||
// Falls back to large/medium WebP thumbnails for older media items.
|
||||
let dataUrl = await this.mediaEngine.getThumbnailDataUrl(mediaId, 'ai');
|
||||
let needsConversion = false;
|
||||
if (!dataUrl) {
|
||||
dataUrl = await this.mediaEngine.getThumbnailDataUrl(mediaId, 'large');
|
||||
needsConversion = true;
|
||||
}
|
||||
if (!dataUrl) {
|
||||
dataUrl = await this.mediaEngine.getThumbnailDataUrl(mediaId, 'medium');
|
||||
needsConversion = true;
|
||||
}
|
||||
if (!dataUrl) {
|
||||
return { success: false, error: 'Image thumbnail not available. Try regenerating thumbnails from Settings.' };
|
||||
}
|
||||
|
||||
const base64Data = dataUrl.replace(/^data:image\/\w+;base64,/, '');
|
||||
const languageName = LANGUAGE_NAMES[language] || language;
|
||||
|
||||
const systemPrompt = `Generate title, alt text, and caption for this image in ${languageName}.
|
||||
let jpegBase64: string;
|
||||
if (needsConversion) {
|
||||
// Legacy path: convert WebP thumbnail to JPEG for model compatibility.
|
||||
const sharp = (await import('sharp')).default;
|
||||
const jpegBuffer = await sharp(Buffer.from(base64Data, 'base64'))
|
||||
.jpeg({ quality: 85 })
|
||||
.toBuffer();
|
||||
jpegBase64 = jpegBuffer.toString('base64');
|
||||
} else {
|
||||
// Fast path: AI thumbnail is already JPEG — use directly.
|
||||
jpegBase64 = base64Data;
|
||||
}
|
||||
|
||||
TITLE: A short, descriptive title for display in lists and search results (3-8 words). Should identify the main subject.
|
||||
ALT: Describe ONLY what is visually present in the image. Be factual, neutral, and concise (5-12 words max). No interpretations, emotions, or "Image of" prefix. Example: "Red bicycle leaning against white brick wall"
|
||||
CAPTION: Short, engaging blog caption (5-20 words).
|
||||
|
||||
Respond with JSON only: {"title": "...", "alt": "...", "caption": "..."}`;
|
||||
const renderLanguage = resolveSupportedRenderLanguage(language);
|
||||
const systemPrompt = translateRender(renderLanguage, 'ai.imageAnalysis.system');
|
||||
const userPrompt = translateRender(renderLanguage, 'ai.imageAnalysis.user');
|
||||
|
||||
try {
|
||||
const model = this.providers.resolveModel(modelId);
|
||||
@@ -233,8 +253,8 @@ Respond with JSON only: {"title": "...", "alt": "...", "caption": "..."}`;
|
||||
messages: [{
|
||||
role: 'user',
|
||||
content: [
|
||||
{ type: 'image', image: `data:image/webp;base64,${base64Data}` },
|
||||
{ type: 'text', text: 'Analyze and respond with JSON.' },
|
||||
{ type: 'image', image: `data:image/jpeg;base64,${jpegBase64}` },
|
||||
{ type: 'text', text: userPrompt },
|
||||
],
|
||||
}],
|
||||
maxOutputTokens: 200,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Uses ProviderRegistry, ChatService, and OneShotTasks.
|
||||
*/
|
||||
|
||||
import { ipcMain, BrowserWindow } from 'electron';
|
||||
import { ipcMain, BrowserWindow, net } from 'electron';
|
||||
import { ChatEngine } from '../engine/ChatEngine';
|
||||
import { SecureKeyStore } from '../engine/SecureKeyStore';
|
||||
import { ProviderRegistry } from '../engine/ai/providers';
|
||||
@@ -61,6 +61,14 @@ function getProviders(): ProviderRegistry {
|
||||
return providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether airplane (offline) mode is currently active.
|
||||
* Exported so other handler modules can guard network operations.
|
||||
*/
|
||||
export function isOfflineModeActive(): boolean {
|
||||
return getProviders().isOfflineMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ChatService (lazy-init).
|
||||
*/
|
||||
@@ -124,6 +132,52 @@ async function ensureInitialized(): Promise<void> {
|
||||
reg.loadOllamaModelCapabilities(caps);
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
|
||||
// Restore known Ollama model IDs (so offline mode works without a fresh fetch)
|
||||
try {
|
||||
const ollamaIds = await getChatEngine().getSetting('ollama_known_model_ids');
|
||||
if (ollamaIds) {
|
||||
for (const id of JSON.parse(ollamaIds) as string[]) reg.registerOllamaModel(id);
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
|
||||
// Restore LM Studio enabled state from settings DB
|
||||
try {
|
||||
const lmstudioEnabled = await getChatEngine().getSetting('lmstudio_enabled');
|
||||
if (lmstudioEnabled === 'true') reg.setLmstudioEnabled(true);
|
||||
} catch { /* ignore */ }
|
||||
|
||||
// Restore LM Studio model capability overrides
|
||||
try {
|
||||
const lmCapsJson = await getChatEngine().getSetting('lmstudio_model_capabilities');
|
||||
if (lmCapsJson) {
|
||||
const caps = JSON.parse(lmCapsJson) as Record<string, { tools: boolean; vision: boolean }>;
|
||||
reg.loadLmstudioModelCapabilities(caps);
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
|
||||
// Restore known LM Studio model IDs (so offline mode works without a fresh fetch)
|
||||
try {
|
||||
const lmIds = await getChatEngine().getSetting('lmstudio_known_model_ids');
|
||||
if (lmIds) {
|
||||
for (const id of JSON.parse(lmIds) as string[]) reg.registerLmstudioModel(id);
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
|
||||
// Restore offline mode from settings or auto-detect via OS network status
|
||||
try {
|
||||
const savedOffline = await getChatEngine().getSetting('offline_mode');
|
||||
if (savedOffline === 'true') {
|
||||
reg.setOfflineMode(true);
|
||||
} else if (savedOffline === null || savedOffline === undefined) {
|
||||
// No explicit preference saved — auto-detect using Electron net API
|
||||
const online = net.isOnline();
|
||||
if (!online && (reg.getProviderStatus().ollama || reg.getProviderStatus().lmstudio)) {
|
||||
reg.setOfflineMode(true);
|
||||
await getChatEngine().setSetting('offline_mode', 'true');
|
||||
}
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
})();
|
||||
}
|
||||
await initPromise;
|
||||
@@ -320,6 +374,169 @@ export function registerChatHandlers(): void {
|
||||
}
|
||||
});
|
||||
|
||||
// ============ LM Studio (Local) ============
|
||||
|
||||
// Get LM Studio enabled state
|
||||
ipcMain.handle('chat:getLmstudioEnabled', async () => {
|
||||
try {
|
||||
await ensureInitialized();
|
||||
return getProviders().isLmstudioEnabled();
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error getting LM Studio enabled state:', error);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Set LM Studio enabled state
|
||||
ipcMain.handle('chat:setLmstudioEnabled', async (_, enabled: boolean) => {
|
||||
try {
|
||||
await ensureInitialized();
|
||||
const reg = getProviders();
|
||||
reg.setLmstudioEnabled(enabled);
|
||||
|
||||
// Persist to settings DB
|
||||
await getChatEngine().setSetting('lmstudio_enabled', enabled ? 'true' : 'false');
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error setting LM Studio enabled state:', error);
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
});
|
||||
|
||||
// Get LM Studio models (probe local server)
|
||||
ipcMain.handle('chat:getLmstudioModels', async () => {
|
||||
try {
|
||||
await ensureInitialized();
|
||||
return await getProviders().fetchLmstudioModels();
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error fetching LM Studio models:', error);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
// Get LM Studio model capability overrides
|
||||
ipcMain.handle('chat:getLmstudioModelCapabilities', async () => {
|
||||
try {
|
||||
await ensureInitialized();
|
||||
return getProviders().getAllLmstudioModelCapabilities();
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error getting LM Studio model capabilities:', error);
|
||||
return {};
|
||||
}
|
||||
});
|
||||
|
||||
// Set capability overrides for a single LM Studio model
|
||||
ipcMain.handle('chat:setLmstudioModelCapabilities', async (_, modelId: string, caps: { tools: boolean; vision: boolean }) => {
|
||||
try {
|
||||
await ensureInitialized();
|
||||
const reg = getProviders();
|
||||
reg.setLmstudioModelCapabilities(modelId, caps);
|
||||
|
||||
// Persist all capabilities to settings DB
|
||||
const allCaps = reg.getAllLmstudioModelCapabilities();
|
||||
await getChatEngine().setSetting('lmstudio_model_capabilities', JSON.stringify(allCaps));
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error setting LM Studio model capabilities:', error);
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
});
|
||||
|
||||
// ============ Offline / Airplane Mode ============
|
||||
|
||||
ipcMain.handle('chat:getOfflineMode', async () => {
|
||||
try {
|
||||
await ensureInitialized();
|
||||
return getProviders().isOfflineMode();
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error getting offline mode:', error);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('chat:setOfflineMode', async (_, enabled: boolean) => {
|
||||
try {
|
||||
await ensureInitialized();
|
||||
const reg = getProviders();
|
||||
reg.setOfflineMode(enabled);
|
||||
await getChatEngine().setSetting('offline_mode', enabled ? 'true' : 'false');
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error setting offline mode:', error);
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('chat:getKnownLocalModels', async () => {
|
||||
try {
|
||||
await ensureInitialized();
|
||||
return getProviders().getKnownLocalModels();
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error getting known local models:', error);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('chat:getOfflineChatModel', async () => {
|
||||
try {
|
||||
const model = await getChatEngine().getSetting('offline_chat_model');
|
||||
return { success: true, modelId: model || null };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error getting offline chat model:', error);
|
||||
return { success: false, modelId: null };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('chat:setOfflineChatModel', async (_, modelId: string | null) => {
|
||||
try {
|
||||
await getChatEngine().setSetting('offline_chat_model', modelId ?? '');
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error setting offline chat model:', error);
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('chat:getOfflineTitleModel', async () => {
|
||||
try {
|
||||
const model = await getChatEngine().getSetting('offline_title_model');
|
||||
return { success: true, modelId: model || null };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error getting offline title model:', error);
|
||||
return { success: false, modelId: null };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('chat:setOfflineTitleModel', async (_, modelId: string | null) => {
|
||||
try {
|
||||
await getChatEngine().setSetting('offline_title_model', modelId ?? '');
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error setting offline title model:', error);
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('chat:getOfflineImageAnalysisModel', async () => {
|
||||
try {
|
||||
const model = await getChatEngine().getSetting('offline_image_analysis_model');
|
||||
return { success: true, modelId: model || null };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error getting offline image analysis model:', error);
|
||||
return { success: false, modelId: null };
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.handle('chat:setOfflineImageAnalysisModel', async (_, modelId: string | null) => {
|
||||
try {
|
||||
await getChatEngine().setSetting('offline_image_analysis_model', modelId ?? '');
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error setting offline image analysis model:', error);
|
||||
return { success: false, error: (error as Error).message };
|
||||
}
|
||||
});
|
||||
|
||||
// ============ Per-Purpose Model Preferences ============
|
||||
|
||||
// Get title generation model
|
||||
@@ -376,9 +593,21 @@ export function registerChatHandlers(): void {
|
||||
ipcMain.handle('chat:getAvailableModels', async () => {
|
||||
try {
|
||||
await ensureInitialized();
|
||||
const models = await getProviders().getAvailableModels();
|
||||
const reg = getProviders();
|
||||
const models = await reg.getAvailableModels();
|
||||
const engine = getChatEngine();
|
||||
const selectedModel = await engine.getSelectedModel();
|
||||
|
||||
// Persist known local model IDs so offline mode survives restarts
|
||||
const ollamaModels = models.filter(m => m.provider === 'ollama').map(m => m.id);
|
||||
const lmstudioModels = models.filter(m => m.provider === 'lmstudio').map(m => m.id);
|
||||
if (ollamaModels.length > 0) {
|
||||
await engine.setSetting('ollama_known_model_ids', JSON.stringify(ollamaModels)).catch(() => {});
|
||||
}
|
||||
if (lmstudioModels.length > 0) {
|
||||
await engine.setSetting('lmstudio_known_model_ids', JSON.stringify(lmstudioModels)).catch(() => {});
|
||||
}
|
||||
|
||||
return { success: true, models, selectedModel };
|
||||
} catch (error) {
|
||||
console.error('[Chat IPC] Error getting models:', error);
|
||||
|
||||
@@ -17,6 +17,7 @@ import { generateBlogmarkBookmarkletSource } from '../shared/blogmark';
|
||||
import { registerMetadataDiffHandlers } from './metadataDiffHandlers';
|
||||
import { registerBlogHandlers } from './blogHandlers';
|
||||
import { registerPublishHandlers } from './publishHandlers';
|
||||
import { isOfflineModeActive } from './chatHandlers';
|
||||
import type { EngineBundle } from '../engine/EngineBundle';
|
||||
|
||||
/**
|
||||
@@ -179,16 +180,25 @@ export function registerIpcHandlers(bundle: EngineBundle): void {
|
||||
});
|
||||
|
||||
safeHandle('git:remoteState', async (_, projectPath: string) => {
|
||||
if (isOfflineModeActive()) {
|
||||
return { ahead: 0, behind: 0 };
|
||||
}
|
||||
const engine = bundle.gitEngine;
|
||||
return engine.getRemoteState(projectPath);
|
||||
});
|
||||
|
||||
safeHandle('git:fetch', async (_, projectPath: string) => {
|
||||
if (isOfflineModeActive()) {
|
||||
return { success: false, code: 'offline' };
|
||||
}
|
||||
const engine = bundle.gitEngine;
|
||||
return engine.fetch(projectPath);
|
||||
});
|
||||
|
||||
safeHandle('git:pull', async (_, projectPath: string) => {
|
||||
if (isOfflineModeActive()) {
|
||||
return { success: false, code: 'offline' };
|
||||
}
|
||||
const engine = bundle.gitEngine;
|
||||
const beforeHead = await engine.getHeadCommit(projectPath);
|
||||
const pullResult = await engine.pull(projectPath);
|
||||
@@ -244,6 +254,9 @@ export function registerIpcHandlers(bundle: EngineBundle): void {
|
||||
});
|
||||
|
||||
safeHandle('git:push', async (_, projectPath: string) => {
|
||||
if (isOfflineModeActive()) {
|
||||
return { success: false, code: 'offline' };
|
||||
}
|
||||
const engine = bundle.gitEngine;
|
||||
return engine.push(projectPath);
|
||||
});
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import type { PublishCredentials } from '../engine/PublishEngine';
|
||||
import type { EngineBundle } from '../engine/EngineBundle';
|
||||
import { isOfflineModeActive } from './chatHandlers';
|
||||
|
||||
type SafeHandle = (channel: string, handler: (...args: any[]) => Promise<any>) => void;
|
||||
|
||||
export function registerPublishHandlers(safeHandle: SafeHandle, bundle: EngineBundle): void {
|
||||
safeHandle('publish:uploadSite', async (_event: unknown, credentials: PublishCredentials) => {
|
||||
if (isOfflineModeActive()) {
|
||||
throw new Error('Airplane mode is active. Disable it to upload the site.');
|
||||
}
|
||||
|
||||
const projectEngine = bundle.projectEngine;
|
||||
const project = await projectEngine.getActiveProject();
|
||||
if (!project) {
|
||||
|
||||
@@ -321,6 +321,24 @@ export const electronAPI: ElectronAPI = {
|
||||
getOllamaModelCapabilities: () => ipcRenderer.invoke('chat:getOllamaModelCapabilities'),
|
||||
setOllamaModelCapabilities: (modelId: string, caps: { tools: boolean; vision: boolean }) => ipcRenderer.invoke('chat:setOllamaModelCapabilities', modelId, caps),
|
||||
|
||||
// LM Studio (Local)
|
||||
getLmstudioEnabled: () => ipcRenderer.invoke('chat:getLmstudioEnabled'),
|
||||
setLmstudioEnabled: (enabled: boolean) => ipcRenderer.invoke('chat:setLmstudioEnabled', enabled),
|
||||
getLmstudioModels: () => ipcRenderer.invoke('chat:getLmstudioModels'),
|
||||
getLmstudioModelCapabilities: () => ipcRenderer.invoke('chat:getLmstudioModelCapabilities'),
|
||||
setLmstudioModelCapabilities: (modelId: string, caps: { tools: boolean; vision: boolean }) => ipcRenderer.invoke('chat:setLmstudioModelCapabilities', modelId, caps),
|
||||
|
||||
// Offline / Airplane Mode
|
||||
getOfflineMode: () => ipcRenderer.invoke('chat:getOfflineMode'),
|
||||
setOfflineMode: (enabled: boolean) => ipcRenderer.invoke('chat:setOfflineMode', enabled),
|
||||
getOfflineChatModel: () => ipcRenderer.invoke('chat:getOfflineChatModel'),
|
||||
setOfflineChatModel: (modelId: string | null) => ipcRenderer.invoke('chat:setOfflineChatModel', modelId),
|
||||
getOfflineTitleModel: () => ipcRenderer.invoke('chat:getOfflineTitleModel'),
|
||||
setOfflineTitleModel: (modelId: string | null) => ipcRenderer.invoke('chat:setOfflineTitleModel', modelId),
|
||||
getOfflineImageAnalysisModel: () => ipcRenderer.invoke('chat:getOfflineImageAnalysisModel'),
|
||||
setOfflineImageAnalysisModel: (modelId: string | null) => ipcRenderer.invoke('chat:setOfflineImageAnalysisModel', modelId),
|
||||
getKnownLocalModels: () => ipcRenderer.invoke('chat:getKnownLocalModels'),
|
||||
|
||||
// Per-Purpose Model Preferences
|
||||
getTitleModel: () => ipcRenderer.invoke('chat:getTitleModel'),
|
||||
setTitleModel: (modelId: string | null) => ipcRenderer.invoke('chat:setTitleModel', modelId),
|
||||
|
||||
@@ -384,7 +384,7 @@ export interface GitLfsPruneResult {
|
||||
|
||||
export interface GitActionResult {
|
||||
success: boolean;
|
||||
code?: 'auth-required' | 'conflict' | 'network' | 'action-failed';
|
||||
code?: 'auth-required' | 'conflict' | 'network' | 'action-failed' | 'offline';
|
||||
error?: string;
|
||||
guidance?: string[];
|
||||
}
|
||||
@@ -451,7 +451,7 @@ export interface ChatReadyStatus {
|
||||
ready: boolean;
|
||||
error?: string;
|
||||
backend?: string;
|
||||
providers?: { opencode: boolean; mistral: boolean; ollama: boolean };
|
||||
providers?: { opencode: boolean; mistral: boolean; ollama: boolean; lmstudio: boolean; offlineMode: boolean };
|
||||
}
|
||||
|
||||
export interface ChatApiKeyStatus {
|
||||
@@ -839,6 +839,24 @@ export interface ElectronAPI {
|
||||
getOllamaModelCapabilities: () => Promise<Record<string, { tools: boolean; vision: boolean }>>;
|
||||
setOllamaModelCapabilities: (modelId: string, caps: { tools: boolean; vision: boolean }) => Promise<{ success: boolean; error?: string }>;
|
||||
|
||||
// LM Studio (local)
|
||||
getLmstudioEnabled: () => Promise<boolean>;
|
||||
setLmstudioEnabled: (enabled: boolean) => Promise<{ success: boolean; error?: string }>;
|
||||
getLmstudioModels: () => Promise<ChatModel[]>;
|
||||
getLmstudioModelCapabilities: () => Promise<Record<string, { tools: boolean; vision: boolean }>>;
|
||||
setLmstudioModelCapabilities: (modelId: string, caps: { tools: boolean; vision: boolean }) => Promise<{ success: boolean; error?: string }>;
|
||||
|
||||
// Offline / Airplane mode
|
||||
getOfflineMode: () => Promise<boolean>;
|
||||
setOfflineMode: (enabled: boolean) => Promise<{ success: boolean; error?: string }>;
|
||||
getOfflineChatModel: () => Promise<{ success: boolean; modelId?: string | null }>;
|
||||
setOfflineChatModel: (modelId: string | null) => Promise<{ success: boolean; error?: string }>;
|
||||
getOfflineTitleModel: () => Promise<{ success: boolean; modelId?: string | null }>;
|
||||
setOfflineTitleModel: (modelId: string | null) => Promise<{ success: boolean; error?: string }>;
|
||||
getOfflineImageAnalysisModel: () => Promise<{ success: boolean; modelId?: string | null }>;
|
||||
setOfflineImageAnalysisModel: (modelId: string | null) => Promise<{ success: boolean; error?: string }>;
|
||||
getKnownLocalModels: () => Promise<ChatModel[]>;
|
||||
|
||||
// Settings
|
||||
getAvailableModels: () => Promise<{ success: boolean; models?: ChatModel[]; selectedModel?: string; error?: string }>;
|
||||
setDefaultModel: (modelId: string) => Promise<{ success: boolean; error?: string }>;
|
||||
|
||||
@@ -78,5 +78,7 @@
|
||||
"render.month.9": "Sept.",
|
||||
"render.month.10": "Oktober",
|
||||
"render.month.11": "Nov.",
|
||||
"render.month.12": "Dezember"
|
||||
"render.month.12": "Dezember",
|
||||
"ai.imageAnalysis.system": "Du erzeugst Bild-Metadaten. Schreibe alle Werte auf Deutsch.\n\nRegeln:\n- \"title\": kurzer beschreibender Titel (3-8 Wörter)\n- \"alt\": sachliche Beschreibung des Sichtbaren (5-12 Wörter). Keine Interpretationen. Kein Präfix \"Bild von\".\n- \"caption\": ansprechende Blog-Bildunterschrift (5-20 Wörter)\n\nAntworte ausschließlich mit JSON: {\"title\": \"...\", \"alt\": \"...\", \"caption\": \"...\"}",
|
||||
"ai.imageAnalysis.user": "Analysiere dieses Bild. Antworte mit JSON auf Deutsch."
|
||||
}
|
||||
|
||||
@@ -78,5 +78,7 @@
|
||||
"render.month.9": "September",
|
||||
"render.month.10": "October",
|
||||
"render.month.11": "November",
|
||||
"render.month.12": "December"
|
||||
"render.month.12": "December",
|
||||
"ai.imageAnalysis.system": "You generate image metadata. Write all values in English.\n\nRules:\n- \"title\": short descriptive title (3-8 words)\n- \"alt\": factual description of what is visible (5-12 words). No interpretations. No \"Image of\" prefix.\n- \"caption\": engaging blog caption (5-20 words)\n\nRespond with JSON only: {\"title\": \"...\", \"alt\": \"...\", \"caption\": \"...\"}",
|
||||
"ai.imageAnalysis.user": "Analyze this image. Respond with JSON in English."
|
||||
}
|
||||
|
||||
@@ -78,5 +78,7 @@
|
||||
"render.month.9": "septiembre",
|
||||
"render.month.10": "octubre",
|
||||
"render.month.11": "noviembre",
|
||||
"render.month.12": "diciembre"
|
||||
"render.month.12": "diciembre",
|
||||
"ai.imageAnalysis.system": "Generas metadatos de imagen. Escribe todos los valores en español.\n\nReglas:\n- \"title\": título descriptivo corto (3-8 palabras)\n- \"alt\": descripción factual de lo visible (5-12 palabras). Sin interpretaciones. Sin prefijo \"Imagen de\".\n- \"caption\": pie de foto atractivo para blog (5-20 palabras)\n\nResponde solo con JSON: {\"title\": \"...\", \"alt\": \"...\", \"caption\": \"...\"}",
|
||||
"ai.imageAnalysis.user": "Analiza esta imagen. Responde con JSON en español."
|
||||
}
|
||||
|
||||
@@ -78,5 +78,7 @@
|
||||
"render.month.9": "septembre",
|
||||
"render.month.10": "octobre",
|
||||
"render.month.11": "novembre",
|
||||
"render.month.12": "décembre"
|
||||
"render.month.12": "décembre",
|
||||
"ai.imageAnalysis.system": "Tu génères des métadonnées d'image. Écris toutes les valeurs en français.\n\nRègles :\n- \"title\" : titre descriptif court (3-8 mots)\n- \"alt\" : description factuelle de ce qui est visible (5-12 mots). Pas d'interprétations. Pas de préfixe \"Image de\".\n- \"caption\" : légende de blog engageante (5-20 mots)\n\nRéponds uniquement en JSON : {\"title\": \"...\", \"alt\": \"...\", \"caption\": \"...\"}",
|
||||
"ai.imageAnalysis.user": "Analyse cette image. Réponds en JSON en français."
|
||||
}
|
||||
|
||||
@@ -78,5 +78,7 @@
|
||||
"render.month.9": "settembre",
|
||||
"render.month.10": "ottobre",
|
||||
"render.month.11": "novembre",
|
||||
"render.month.12": "dicembre"
|
||||
"render.month.12": "dicembre",
|
||||
"ai.imageAnalysis.system": "Generi metadati per immagini. Scrivi tutti i valori in italiano.\n\nRegole:\n- \"title\": titolo descrittivo breve (3-8 parole)\n- \"alt\": descrizione fattuale di ciò che è visibile (5-12 parole). Nessuna interpretazione. Nessun prefisso \"Immagine di\".\n- \"caption\": didascalia blog coinvolgente (5-20 parole)\n\nRispondi solo con JSON: {\"title\": \"...\", \"alt\": \"...\", \"caption\": \"...\"}",
|
||||
"ai.imageAnalysis.user": "Analizza questa immagine. Rispondi con JSON in italiano."
|
||||
}
|
||||
|
||||
@@ -520,9 +520,13 @@ const App: React.FC = () => {
|
||||
return;
|
||||
}
|
||||
await window.electronAPI?.publish.uploadSite(prefs);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error('Site upload failed:', error);
|
||||
showToast.error(tr('app.uploadSiteFailed'));
|
||||
if (error?.message?.includes('Airplane mode')) {
|
||||
useAppStore.getState().showErrorModal({ message: tr('app.uploadSiteOfflineMode') });
|
||||
} else {
|
||||
showToast.error(tr('app.uploadSiteFailed'));
|
||||
}
|
||||
}
|
||||
}) || (() => {})
|
||||
);
|
||||
|
||||
@@ -15,9 +15,9 @@ interface ErrorModalProps {
|
||||
|
||||
export const ErrorModal: React.FC<ErrorModalProps> = ({ error, onClose }) => {
|
||||
const { t: tr } = useI18n();
|
||||
if (!error) return null;
|
||||
|
||||
const handleCopyStack = useCallback(async () => {
|
||||
if (!error) return;
|
||||
const textToCopy = `${error.title || tr('errorModal.error')}\n${error.message}\n\n${tr('errorModal.stackTrace')}:\n${error.stack || tr('errorModal.noStack')}`;
|
||||
try {
|
||||
await navigator.clipboard.writeText(textToCopy);
|
||||
@@ -32,6 +32,8 @@ export const ErrorModal: React.FC<ErrorModalProps> = ({ error, onClose }) => {
|
||||
}
|
||||
}, [onClose]);
|
||||
|
||||
if (!error) return null;
|
||||
|
||||
return (
|
||||
<div className="error-modal-backdrop" onClick={handleBackdropClick}>
|
||||
<div className="error-modal">
|
||||
|
||||
@@ -32,7 +32,7 @@ const mergeStatusFilesIncremental = (
|
||||
|
||||
export const GitSidebar: React.FC = () => {
|
||||
const { t: tr } = useI18n();
|
||||
const { activeProject, openTab, tabs, closeTab } = useAppStore();
|
||||
const { activeProject, openTab, tabs, closeTab, showErrorModal } = useAppStore();
|
||||
const [projectPath, setProjectPath] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [initializing, setInitializing] = useState(false);
|
||||
@@ -390,6 +390,10 @@ export const GitSidebar: React.FC = () => {
|
||||
recentCommitsToKeep: 2,
|
||||
});
|
||||
if (!result.success) {
|
||||
if (result.code === 'offline') {
|
||||
showErrorModal({ message: tr('gitSidebar.error.offlineMode') });
|
||||
return;
|
||||
}
|
||||
setError(result.error || tr('gitSidebar.error.actionFailed', { action }));
|
||||
setErrorGuidance('guidance' in result ? result.guidance || [] : []);
|
||||
return;
|
||||
|
||||
@@ -565,3 +565,36 @@
|
||||
.ollama-caps-table input[type="checkbox"] {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* LM Studio model capabilities table */
|
||||
.lmstudio-model-capabilities {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.lmstudio-model-capabilities .setting-description {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.lmstudio-caps-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.lmstudio-caps-table th,
|
||||
.lmstudio-caps-table td {
|
||||
padding: 4px 8px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid var(--pico-muted-border-color, #ccc);
|
||||
}
|
||||
|
||||
.lmstudio-caps-table th:not(:first-child),
|
||||
.lmstudio-caps-table td:not(:first-child) {
|
||||
text-align: center;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.lmstudio-caps-table input[type="checkbox"] {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@@ -248,6 +248,14 @@ export const SettingsView: React.FC = () => {
|
||||
const [ollamaEnabled, setOllamaEnabled] = useState(false);
|
||||
const [ollamaCapabilities, setOllamaCapabilities] = useState<Record<string, { tools: boolean; vision: boolean }>>({});
|
||||
const [ollamaModels, setOllamaModels] = useState<{id: string; name: string}[]>([]);
|
||||
const [lmstudioEnabled, setLmstudioEnabled] = useState(false);
|
||||
const [lmstudioCapabilities, setLmstudioCapabilities] = useState<Record<string, { tools: boolean; vision: boolean }>>({});
|
||||
const [lmstudioModels, setLmstudioModels] = useState<{id: string; name: string}[]>([]);
|
||||
const [offlineModeEnabled, setOfflineModeEnabled] = useState(false);
|
||||
const [offlineChatModel, setOfflineChatModel] = useState('');
|
||||
const [offlineTitleModel, setOfflineTitleModel] = useState('');
|
||||
const [offlineImageAnalysisModel, setOfflineImageAnalysisModel] = useState('');
|
||||
const [knownLocalModels, setKnownLocalModels] = useState<{id: string; name: string; provider?: string; vision?: boolean}[]>([]);
|
||||
const [titleModel, setTitleModel] = useState('claude-haiku-4-5');
|
||||
const [imageAnalysisModel, setImageAnalysisModel] = useState('claude-sonnet-4-5');
|
||||
const [availableModels, setAvailableModels] = useState<{id: string; name: string; provider?: string; vision?: boolean}[]>([]);
|
||||
@@ -432,6 +440,20 @@ export const SettingsView: React.FC = () => {
|
||||
if (models) setOllamaModels(models.map(m => ({ id: m.id, name: m.name })));
|
||||
}
|
||||
|
||||
// Load LM Studio enabled state
|
||||
const lmstudioState = await window.electronAPI?.chat.getLmstudioEnabled();
|
||||
setLmstudioEnabled(!!lmstudioState);
|
||||
|
||||
// Load LM Studio model capabilities and models list
|
||||
if (lmstudioState) {
|
||||
const [lmCaps, lmModels] = await Promise.all([
|
||||
window.electronAPI?.chat.getLmstudioModelCapabilities(),
|
||||
window.electronAPI?.chat.getLmstudioModels(),
|
||||
]);
|
||||
if (lmCaps) setLmstudioCapabilities(lmCaps);
|
||||
if (lmModels) setLmstudioModels(lmModels.map(m => ({ id: m.id, name: m.name })));
|
||||
}
|
||||
|
||||
// Load per-purpose model preferences
|
||||
const titleModelResult = await window.electronAPI?.chat.getTitleModel();
|
||||
if (titleModelResult?.success && titleModelResult.modelId) {
|
||||
@@ -442,6 +464,22 @@ export const SettingsView: React.FC = () => {
|
||||
setImageAnalysisModel(imageModelResult.modelId);
|
||||
}
|
||||
|
||||
// Load offline mode preferences
|
||||
const offlineState = await window.electronAPI?.chat.getOfflineMode();
|
||||
setOfflineModeEnabled(!!offlineState);
|
||||
const offlineChat = await window.electronAPI?.chat.getOfflineChatModel();
|
||||
if (offlineChat?.success && offlineChat.modelId) setOfflineChatModel(offlineChat.modelId);
|
||||
const offlineTitle = await window.electronAPI?.chat.getOfflineTitleModel();
|
||||
if (offlineTitle?.success && offlineTitle.modelId) setOfflineTitleModel(offlineTitle.modelId);
|
||||
const offlineImage = await window.electronAPI?.chat.getOfflineImageAnalysisModel();
|
||||
if (offlineImage?.success && offlineImage.modelId) setOfflineImageAnalysisModel(offlineImage.modelId);
|
||||
|
||||
// Load known local models (persisted, no network needed)
|
||||
try {
|
||||
const locals = await window.electronAPI?.chat.getKnownLocalModels();
|
||||
if (locals && locals.length > 0) setKnownLocalModels(locals);
|
||||
} catch { /* ignore */ }
|
||||
|
||||
// Load model catalog metadata
|
||||
const catalogResult = await window.electronAPI?.chat.getModelCatalog();
|
||||
if (catalogResult?.success && catalogResult.entries) {
|
||||
@@ -553,7 +591,7 @@ export const SettingsView: React.FC = () => {
|
||||
const projectKeywords = ['project', 'name', 'description', 'blog', 'site', 'url', 'public', 'path', 'folder', 'location', 'data', 'language', 'author', 'default', 'preview', 'max', 'posts', 'page', 'bookmarklet', 'blogmark'];
|
||||
const editorKeywords = ['editor', 'mode', 'wysiwyg', 'markdown', 'preview', 'visual'];
|
||||
const contentKeywords = ['content', 'categories', 'post', 'article', 'picture', 'aside', 'page'];
|
||||
const aiKeywords = ['ai', 'assistant', 'chat', 'model', 'prompt', 'system', 'api', 'key', 'claude', 'gpt', 'opencode', 'ollama', 'local'];
|
||||
const aiKeywords = ['ai', 'assistant', 'chat', 'model', 'prompt', 'system', 'api', 'key', 'claude', 'gpt', 'opencode', 'ollama', 'lmstudio', 'lm studio', 'local'];
|
||||
const technologyKeywords = ['technology', 'python', 'runtime', 'worker', 'webworker', 'main thread', 'execution'];
|
||||
const publishingKeywords = ['publishing', 'ssh', 'deploy', 'server', 'host', 'upload', 'scp', 'rsync'];
|
||||
const dataKeywords = ['data', 'database', 'rebuild', 'maintenance', 'posts', 'media', 'scripts', 'links', 'folder', 'filesystem'];
|
||||
@@ -1210,6 +1248,55 @@ export const SettingsView: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleLmstudioToggle = async (enabled: boolean) => {
|
||||
try {
|
||||
const result = await window.electronAPI?.chat.setLmstudioEnabled(enabled);
|
||||
if (result?.success) {
|
||||
setLmstudioEnabled(enabled);
|
||||
showToast.success(t(enabled ? 'settings.toast.lmstudioEnabled' : 'settings.toast.lmstudioDisabled'));
|
||||
|
||||
// Refresh models after toggle
|
||||
const modelsResult = await window.electronAPI?.chat.getAvailableModels();
|
||||
if (modelsResult?.success && modelsResult.models) {
|
||||
setAvailableModels(modelsResult.models);
|
||||
setSelectedModel(modelsResult.selectedModel || '');
|
||||
}
|
||||
|
||||
// Load LM Studio models and capabilities when enabling
|
||||
if (enabled) {
|
||||
const [caps, lmstudioModelsList] = await Promise.all([
|
||||
window.electronAPI?.chat.getLmstudioModelCapabilities(),
|
||||
window.electronAPI?.chat.getLmstudioModels(),
|
||||
]);
|
||||
if (caps) setLmstudioCapabilities(caps);
|
||||
if (lmstudioModelsList) setLmstudioModels(lmstudioModelsList.map(m => ({ id: m.id, name: m.name })));
|
||||
} else {
|
||||
setLmstudioModels([]);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to toggle LM Studio:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleLmstudioCapabilityToggle = async (modelId: string, field: 'tools' | 'vision', value: boolean) => {
|
||||
const current = lmstudioCapabilities[modelId] ?? { tools: false, vision: false };
|
||||
const updated = { ...current, [field]: value };
|
||||
try {
|
||||
const result = await window.electronAPI?.chat.setLmstudioModelCapabilities(modelId, updated);
|
||||
if (result?.success) {
|
||||
setLmstudioCapabilities(prev => ({ ...prev, [modelId]: updated }));
|
||||
// Refresh available models to reflect vision change
|
||||
const modelsResult = await window.electronAPI?.chat.getAvailableModels();
|
||||
if (modelsResult?.success && modelsResult.models) {
|
||||
setAvailableModels(modelsResult.models);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to update LM Studio model capabilities:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleTitleModelChange = async (modelId: string) => {
|
||||
try {
|
||||
const result = await window.electronAPI?.chat.setTitleModel(modelId);
|
||||
@@ -1232,6 +1319,45 @@ export const SettingsView: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleOfflineToggle = async (enabled: boolean) => {
|
||||
try {
|
||||
const result = await window.electronAPI?.chat.setOfflineMode(enabled);
|
||||
if (result?.success) {
|
||||
setOfflineModeEnabled(enabled);
|
||||
showToast.success(t(enabled ? 'settings.toast.offlineEnabled' : 'settings.toast.offlineDisabled'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to toggle offline mode:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleOfflineChatModelChange = async (modelId: string) => {
|
||||
try {
|
||||
const result = await window.electronAPI?.chat.setOfflineChatModel(modelId);
|
||||
if (result?.success) setOfflineChatModel(modelId);
|
||||
} catch (error) {
|
||||
console.error('Failed to set offline chat model:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleOfflineTitleModelChange = async (modelId: string) => {
|
||||
try {
|
||||
const result = await window.electronAPI?.chat.setOfflineTitleModel(modelId);
|
||||
if (result?.success) setOfflineTitleModel(modelId);
|
||||
} catch (error) {
|
||||
console.error('Failed to set offline title model:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleOfflineImageAnalysisModelChange = async (modelId: string) => {
|
||||
try {
|
||||
const result = await window.electronAPI?.chat.setOfflineImageAnalysisModel(modelId);
|
||||
if (result?.success) setOfflineImageAnalysisModel(modelId);
|
||||
} catch (error) {
|
||||
console.error('Failed to set offline image analysis model:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleModelChange = async (modelId: string) => {
|
||||
try {
|
||||
const result = await window.electronAPI?.chat.setDefaultModel(modelId);
|
||||
@@ -1299,10 +1425,26 @@ export const SettingsView: React.FC = () => {
|
||||
[availableModels, groupModelsByProvider]
|
||||
);
|
||||
|
||||
// Local-only models (for offline / airplane mode selectors)
|
||||
// Prefer knownLocalModels (persisted, always available) over filtering availableModels (needs network)
|
||||
const localModelSource = useMemo(() => {
|
||||
const fromAvailable = availableModels.filter(m => m.provider === 'ollama' || m.provider === 'lmstudio');
|
||||
return fromAvailable.length > 0 ? fromAvailable : knownLocalModels;
|
||||
}, [availableModels, knownLocalModels]);
|
||||
const groupedLocalModels = useMemo(
|
||||
() => groupModelsByProvider(localModelSource),
|
||||
[localModelSource, groupModelsByProvider]
|
||||
);
|
||||
const groupedLocalVisionModels = useMemo(
|
||||
() => groupModelsByProvider(localModelSource.filter(m => m.vision)),
|
||||
[localModelSource, groupModelsByProvider]
|
||||
);
|
||||
|
||||
const providerLabel = (provider: string) => {
|
||||
if (provider === 'anthropic' || provider === 'openai' || provider === 'google' || provider === 'other') return t('settings.ai.providerOpenCode');
|
||||
if (provider === 'mistral') return t('settings.ai.providerMistral');
|
||||
if (provider === 'ollama') return t('settings.ai.providerOllama');
|
||||
if (provider === 'lmstudio') return t('settings.ai.providerLmstudio');
|
||||
return provider;
|
||||
};
|
||||
|
||||
@@ -1472,17 +1614,120 @@ export const SettingsView: React.FC = () => {
|
||||
)}
|
||||
</SettingRow>
|
||||
|
||||
<SettingRow
|
||||
id="ai-lmstudio"
|
||||
label={t('settings.ai.lmstudioLabel')}
|
||||
description={t('settings.ai.lmstudioDescription')}
|
||||
>
|
||||
<div className="setting-input-group">
|
||||
<label className="toggle-label">
|
||||
<input
|
||||
id="ai-lmstudio"
|
||||
type="checkbox"
|
||||
checked={lmstudioEnabled}
|
||||
onChange={(e) => handleLmstudioToggle(e.target.checked)}
|
||||
/>
|
||||
{t('settings.ai.lmstudioEnable')}
|
||||
</label>
|
||||
{lmstudioEnabled && (
|
||||
<span className="setting-status-badge success">{t('settings.ai.configured')}</span>
|
||||
)}
|
||||
</div>
|
||||
{lmstudioEnabled && lmstudioModels.length > 0 && (
|
||||
<div className="lmstudio-model-capabilities">
|
||||
<small className="setting-description">{t('settings.ai.lmstudioCapabilitiesDescription')}</small>
|
||||
<table className="lmstudio-caps-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{t('settings.ai.lmstudioCapModel')}</th>
|
||||
<th>{t('settings.ai.lmstudioCapTools')}</th>
|
||||
<th>{t('settings.ai.lmstudioCapVision')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{lmstudioModels.map(m => {
|
||||
const caps = lmstudioCapabilities[m.id] ?? { tools: false, vision: false };
|
||||
return (
|
||||
<tr key={m.id}>
|
||||
<td>{m.name}</td>
|
||||
<td>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={caps.tools}
|
||||
onChange={(e) => handleLmstudioCapabilityToggle(m.id, 'tools', e.target.checked)}
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={caps.vision}
|
||||
onChange={(e) => handleLmstudioCapabilityToggle(m.id, 'vision', e.target.checked)}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</SettingRow>
|
||||
|
||||
<SettingRow
|
||||
id="ai-offline"
|
||||
label={t('settings.ai.offlineLabel')}
|
||||
description={t('settings.ai.offlineDescription')}
|
||||
>
|
||||
<div className="setting-input-group">
|
||||
<label className="toggle-label">
|
||||
<input
|
||||
id="ai-offline"
|
||||
type="checkbox"
|
||||
checked={offlineModeEnabled}
|
||||
onChange={(e) => handleOfflineToggle(e.target.checked)}
|
||||
disabled={!ollamaEnabled && !lmstudioEnabled}
|
||||
/>
|
||||
{t('settings.ai.offlineEnable')}
|
||||
</label>
|
||||
{offlineModeEnabled && (
|
||||
<span className="setting-status-badge success">{t('settings.ai.configured')}</span>
|
||||
)}
|
||||
</div>
|
||||
{!ollamaEnabled && !lmstudioEnabled && (
|
||||
<small className="setting-description">{t('settings.ai.offlineNoLocalProviders')}</small>
|
||||
)}
|
||||
{offlineModeEnabled && (ollamaEnabled || lmstudioEnabled) && (
|
||||
<div className="offline-model-preferences">
|
||||
<div className="setting-field">
|
||||
<label htmlFor="ai-offline-chat-model">{t('settings.ai.offlineChatModel')}</label>
|
||||
<small className="setting-description">{t('settings.ai.offlineChatModelDescription')}</small>
|
||||
{renderModelSelect('ai-offline-chat-model', offlineChatModel, handleOfflineChatModelChange, false, groupedLocalModels)}
|
||||
</div>
|
||||
<div className="setting-field">
|
||||
<label htmlFor="ai-offline-title-model">{t('settings.ai.offlineTitleModel')}</label>
|
||||
<small className="setting-description">{t('settings.ai.offlineTitleModelDescription')}</small>
|
||||
{renderModelSelect('ai-offline-title-model', offlineTitleModel, handleOfflineTitleModelChange, false, groupedLocalModels)}
|
||||
</div>
|
||||
<div className="setting-field">
|
||||
<label htmlFor="ai-offline-image-model">{t('settings.ai.offlineImageAnalysisModel')}</label>
|
||||
<small className="setting-description">{t('settings.ai.offlineImageAnalysisModelDescription')}</small>
|
||||
{renderModelSelect('ai-offline-image-model', offlineImageAnalysisModel, handleOfflineImageAnalysisModelChange, false, groupedLocalVisionModels)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</SettingRow>
|
||||
|
||||
<SettingRow
|
||||
id="ai-model"
|
||||
label={t('settings.ai.defaultModelLabel')}
|
||||
description={t('settings.ai.defaultModelDescription')}
|
||||
>
|
||||
<div className="setting-input-group">
|
||||
{renderModelSelect('ai-model', selectedModel, handleModelChange, !aiHasApiKey && !aiHasMistralKey && !ollamaEnabled)}
|
||||
{renderModelSelect('ai-model', selectedModel, handleModelChange, !aiHasApiKey && !aiHasMistralKey && !ollamaEnabled && !lmstudioEnabled)}
|
||||
<button
|
||||
className="secondary"
|
||||
onClick={handleRefreshModelCatalog}
|
||||
disabled={refreshingCatalog || (!aiHasApiKey && !aiHasMistralKey && !ollamaEnabled)}
|
||||
disabled={refreshingCatalog || (!aiHasApiKey && !aiHasMistralKey && !ollamaEnabled && !lmstudioEnabled)}
|
||||
title={t('settings.ai.refreshModelCatalog')}
|
||||
>
|
||||
{refreshingCatalog ? t('settings.ai.refreshing') : t('settings.ai.refreshModelCatalog')}
|
||||
@@ -1514,7 +1759,7 @@ export const SettingsView: React.FC = () => {
|
||||
label={t('settings.ai.titleModelLabel')}
|
||||
description={t('settings.ai.titleModelDescription')}
|
||||
>
|
||||
{renderModelSelect('ai-title-model', titleModel, handleTitleModelChange, !aiHasApiKey && !aiHasMistralKey && !ollamaEnabled)}
|
||||
{renderModelSelect('ai-title-model', titleModel, handleTitleModelChange, !aiHasApiKey && !aiHasMistralKey && !ollamaEnabled && !lmstudioEnabled)}
|
||||
</SettingRow>
|
||||
|
||||
<SettingRow
|
||||
@@ -1522,7 +1767,7 @@ export const SettingsView: React.FC = () => {
|
||||
label={t('settings.ai.imageAnalysisModelLabel')}
|
||||
description={t('settings.ai.imageAnalysisModelDescription')}
|
||||
>
|
||||
{renderModelSelect('ai-image-analysis-model', imageAnalysisModel, handleImageAnalysisModelChange, !aiHasApiKey && !aiHasMistralKey && !ollamaEnabled, groupedVisionModels)}
|
||||
{renderModelSelect('ai-image-analysis-model', imageAnalysisModel, handleImageAnalysisModelChange, !aiHasApiKey && !aiHasMistralKey && !ollamaEnabled && !lmstudioEnabled, groupedVisionModels)}
|
||||
</SettingRow>
|
||||
|
||||
<SettingRow
|
||||
|
||||
@@ -123,6 +123,19 @@
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.status-bar-item.offline-badge {
|
||||
cursor: pointer;
|
||||
opacity: 0.4;
|
||||
font-size: 13px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.status-bar-item.offline-badge.active {
|
||||
background-color: var(--vscode-notificationsWarningIcon-foreground);
|
||||
border-radius: 3px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.status-bar-language-select {
|
||||
background: transparent;
|
||||
border: none;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { useAppStore } from '../../store';
|
||||
import { ProjectSelector } from '../ProjectSelector';
|
||||
import { getRendererPicoTheme } from '../../utils/picoTheme';
|
||||
@@ -27,6 +27,22 @@ export const StatusBar: React.FC = () => {
|
||||
} = useAppStore();
|
||||
|
||||
const [selectedPostStatus, setSelectedPostStatus] = useState<string | null>(null);
|
||||
const [offlineMode, setOfflineMode] = useState(false);
|
||||
|
||||
// Fetch offline mode state on mount
|
||||
useEffect(() => {
|
||||
window.electronAPI?.chat?.getOfflineMode().then(setOfflineMode).catch(() => {});
|
||||
}, []);
|
||||
|
||||
const toggleOfflineMode = useCallback(async () => {
|
||||
const newValue = !offlineMode;
|
||||
try {
|
||||
await window.electronAPI?.chat?.setOfflineMode(newValue);
|
||||
setOfflineMode(newValue);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}, [offlineMode]);
|
||||
|
||||
// Fetch selected post status from database
|
||||
useEffect(() => {
|
||||
@@ -96,6 +112,18 @@ export const StatusBar: React.FC = () => {
|
||||
<span>{t('statusBar.theme', { theme: activeTheme })}</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`status-bar-item offline-badge${offlineMode ? ' active' : ''}`}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
data-testid="statusbar-offline-toggle"
|
||||
title={t('statusBar.offlineModeTooltip')}
|
||||
onClick={toggleOfflineMode}
|
||||
onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggleOfflineMode(); } }}
|
||||
>
|
||||
<span>✈</span>
|
||||
</div>
|
||||
|
||||
<div className="status-bar-item language-badge">
|
||||
<span>{t('statusBar.ui')}</span>
|
||||
<select
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
"app.sitemapGenerationFailed": "Sitemap-Erstellung fehlgeschlagen",
|
||||
"app.calendarRegenerationFailed": "Kalender-Neuerstellung fehlgeschlagen",
|
||||
"app.uploadSiteFailed": "Website-Upload fehlgeschlagen",
|
||||
"app.uploadSiteOfflineMode": "Website-Upload ist im Flugmodus nicht verfügbar.",
|
||||
"app.uploadSiteNoCredentials": "Bitte konfigurieren Sie zuerst die SSH-Zugangsdaten in den Einstellungen.",
|
||||
"app.previewOpenFailed": "Ausgewählte Beitragsvorschau konnte nicht geöffnet werden",
|
||||
"app.metadataDiff": "Metadaten-Diff",
|
||||
@@ -314,6 +315,7 @@
|
||||
"gitSidebar.error.loadRepoStatus": "Repository-Status konnte nicht geladen werden.",
|
||||
"gitSidebar.error.initFailed": "Git-Repository konnte nicht initialisiert werden.",
|
||||
"gitSidebar.error.actionFailed": "Fehler beim {action}.",
|
||||
"gitSidebar.error.offlineMode": "Diese Aktion ist im Flugmodus nicht verfügbar.",
|
||||
"gitSidebar.error.commitFailed": "Änderungen konnten nicht committet werden.",
|
||||
"gitSidebar.progress.preparingInit": "Repository-Initialisierung wird vorbereitet...",
|
||||
"gitSidebar.progress.pushingRemote": "Commits werden zum Remote übertragen... das kann bei großen Uploads eine Weile dauern.",
|
||||
@@ -742,6 +744,7 @@
|
||||
"settings.ai.providerOpenCode": "OpenCode",
|
||||
"settings.ai.providerMistral": "Mistral",
|
||||
"settings.ai.providerOllama": "Ollama (Lokal)",
|
||||
"settings.ai.providerLmstudio": "LM Studio (Lokal)",
|
||||
"settings.ai.providerOther": "Andere",
|
||||
"settings.ai.ollamaLabel": "Ollama (Lokale Modelle)",
|
||||
"settings.ai.ollamaDescription": "Verbinde dich mit einer lokal laufenden Ollama-Instanz, um lokale KI-Modelle zu verwenden.",
|
||||
@@ -756,6 +759,28 @@
|
||||
"settings.toast.modelCatalogRefreshFailed": "Modellkatalog konnte nicht aktualisiert werden",
|
||||
"settings.toast.ollamaEnabled": "Ollama aktiviert",
|
||||
"settings.toast.ollamaDisabled": "Ollama deaktiviert",
|
||||
"settings.ai.lmstudioLabel": "LM Studio (Lokale Modelle)",
|
||||
"settings.ai.lmstudioDescription": "Verbinde dich mit einer lokal laufenden LM Studio-Instanz, um lokale KI-Modelle zu verwenden.",
|
||||
"settings.ai.lmstudioEnable": "LM Studio aktivieren",
|
||||
"settings.ai.lmstudioCapabilitiesDescription": "Fähigkeiten für jedes LM Studio-Modell konfigurieren. Tools für Funktionsaufrufe oder Vision für Bildanalyse aktivieren.",
|
||||
"settings.ai.lmstudioCapModel": "Modell",
|
||||
"settings.ai.lmstudioCapTools": "Tools",
|
||||
"settings.ai.lmstudioCapVision": "Vision",
|
||||
"settings.toast.lmstudioEnabled": "LM Studio aktiviert",
|
||||
"settings.toast.lmstudioDisabled": "LM Studio deaktiviert",
|
||||
"settings.ai.offlineLabel": "Flugmodus",
|
||||
"settings.ai.offlineDescription": "Wenn aktiviert, werden nur lokal gehostete Modelle (Ollama, LM Studio) verwendet. Cloud-Anbieter werden deaktiviert.",
|
||||
"settings.ai.offlineEnable": "Flugmodus aktivieren",
|
||||
"settings.ai.offlineChatModel": "Offline-Chat-Modell",
|
||||
"settings.ai.offlineChatModelDescription": "Modell für Chat-Gespräche im Flugmodus.",
|
||||
"settings.ai.offlineTitleModel": "Offline-Titelmodell",
|
||||
"settings.ai.offlineTitleModelDescription": "Modell für die Titelgenerierung im Flugmodus.",
|
||||
"settings.ai.offlineImageAnalysisModel": "Offline-Bildanalysemodell",
|
||||
"settings.ai.offlineImageAnalysisModelDescription": "Modell für die Bildanalyse im Flugmodus.",
|
||||
"settings.ai.offlineNoLocalProviders": "Keine lokalen Anbieter aktiviert. Aktiviere zuerst Ollama oder LM Studio.",
|
||||
"settings.ai.offlineNoLocalModels": "Keine lokalen Modelle verfügbar",
|
||||
"settings.toast.offlineEnabled": "Flugmodus aktiviert",
|
||||
"settings.toast.offlineDisabled": "Flugmodus deaktiviert",
|
||||
"settings.publishing.sshHostDescription": "Hostname oder IP-Adresse des SSH-Servers.",
|
||||
"settings.publishing.sshUsernameDescription": "Benutzername deines SSH-Kontos.",
|
||||
"settings.publishing.sshRemotePathDescription": "Das Zielverzeichnis auf dem Remote-Server, in das dein Blog veröffentlicht wird.",
|
||||
@@ -891,6 +916,9 @@
|
||||
"statusBar.theme": "Theme: {theme}",
|
||||
"statusBar.ui": "UI",
|
||||
"statusBar.uiLanguage": "UI-Sprache",
|
||||
"statusBar.offlineMode": "Flugmodus",
|
||||
"statusBar.offlineModeActive": "Flugmodus (aktiv)",
|
||||
"statusBar.offlineModeTooltip": "Klicken zum Umschalten des Flugmodus",
|
||||
"windowTitleBar.toggleSidebar": "Seitenleiste umschalten",
|
||||
"windowTitleBar.hideSidebar": "Seitenleiste ausblenden (Ctrl+B)",
|
||||
"windowTitleBar.showSidebar": "Seitenleiste anzeigen (Ctrl+B)",
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
"app.sitemapGenerationFailed": "Sitemap generation failed",
|
||||
"app.calendarRegenerationFailed": "Calendar regeneration failed",
|
||||
"app.uploadSiteFailed": "Site upload failed",
|
||||
"app.uploadSiteOfflineMode": "Site upload is blocked while airplane mode is active.",
|
||||
"app.uploadSiteNoCredentials": "Please configure SSH publishing credentials in Settings first.",
|
||||
"app.previewOpenFailed": "Failed to open selected post preview",
|
||||
"app.metadataDiff": "Metadata Diff",
|
||||
@@ -314,6 +315,7 @@
|
||||
"gitSidebar.error.loadRepoStatus": "Unable to load repository status.",
|
||||
"gitSidebar.error.initFailed": "Failed to initialize git repository.",
|
||||
"gitSidebar.error.actionFailed": "Failed to {action}.",
|
||||
"gitSidebar.error.offlineMode": "This action is blocked while airplane mode is active.",
|
||||
"gitSidebar.error.commitFailed": "Failed to commit changes.",
|
||||
"gitSidebar.progress.preparingInit": "Preparing repository initialization...",
|
||||
"gitSidebar.progress.pushingRemote": "Pushing commits to remote... this can take a while for large uploads.",
|
||||
@@ -742,6 +744,7 @@
|
||||
"settings.ai.providerOpenCode": "OpenCode",
|
||||
"settings.ai.providerMistral": "Mistral",
|
||||
"settings.ai.providerOllama": "Ollama (Local)",
|
||||
"settings.ai.providerLmstudio": "LM Studio (Local)",
|
||||
"settings.ai.providerOther": "Other",
|
||||
"settings.ai.ollamaLabel": "Ollama (Local Models)",
|
||||
"settings.ai.ollamaDescription": "Connect to a locally running Ollama instance to use local AI models.",
|
||||
@@ -756,6 +759,28 @@
|
||||
"settings.toast.modelCatalogRefreshFailed": "Failed to refresh model catalog",
|
||||
"settings.toast.ollamaEnabled": "Ollama enabled",
|
||||
"settings.toast.ollamaDisabled": "Ollama disabled",
|
||||
"settings.ai.lmstudioLabel": "LM Studio (Local Models)",
|
||||
"settings.ai.lmstudioDescription": "Connect to a locally running LM Studio instance to use local AI models.",
|
||||
"settings.ai.lmstudioEnable": "Enable LM Studio",
|
||||
"settings.ai.lmstudioCapabilitiesDescription": "Configure capabilities for each LM Studio model. Enable tools for function calling or vision for image analysis.",
|
||||
"settings.ai.lmstudioCapModel": "Model",
|
||||
"settings.ai.lmstudioCapTools": "Tools",
|
||||
"settings.ai.lmstudioCapVision": "Vision",
|
||||
"settings.toast.lmstudioEnabled": "LM Studio enabled",
|
||||
"settings.toast.lmstudioDisabled": "LM Studio disabled",
|
||||
"settings.ai.offlineLabel": "Airplane Mode",
|
||||
"settings.ai.offlineDescription": "When enabled, only locally hosted models (Ollama, LM Studio) are used. Cloud providers are disabled.",
|
||||
"settings.ai.offlineEnable": "Enable Airplane Mode",
|
||||
"settings.ai.offlineChatModel": "Offline Chat Model",
|
||||
"settings.ai.offlineChatModelDescription": "Model used for chat conversations when in airplane mode.",
|
||||
"settings.ai.offlineTitleModel": "Offline Title Model",
|
||||
"settings.ai.offlineTitleModelDescription": "Model used for title generation when in airplane mode.",
|
||||
"settings.ai.offlineImageAnalysisModel": "Offline Image Analysis Model",
|
||||
"settings.ai.offlineImageAnalysisModelDescription": "Model used for image analysis when in airplane mode.",
|
||||
"settings.ai.offlineNoLocalProviders": "No local providers enabled. Enable Ollama or LM Studio first.",
|
||||
"settings.ai.offlineNoLocalModels": "No local models available",
|
||||
"settings.toast.offlineEnabled": "Airplane mode enabled",
|
||||
"settings.toast.offlineDisabled": "Airplane mode disabled",
|
||||
"settings.publishing.sshHostDescription": "The SSH server hostname or IP address.",
|
||||
"settings.publishing.sshUsernameDescription": "Your SSH account username.",
|
||||
"settings.publishing.sshRemotePathDescription": "The destination directory on the remote server where your blog will be published.",
|
||||
@@ -891,6 +916,9 @@
|
||||
"statusBar.theme": "Theme: {theme}",
|
||||
"statusBar.ui": "UI",
|
||||
"statusBar.uiLanguage": "UI language",
|
||||
"statusBar.offlineMode": "Airplane Mode",
|
||||
"statusBar.offlineModeActive": "Airplane Mode (active)",
|
||||
"statusBar.offlineModeTooltip": "Click to toggle airplane mode",
|
||||
"windowTitleBar.toggleSidebar": "Toggle Sidebar",
|
||||
"windowTitleBar.hideSidebar": "Hide Sidebar (Ctrl+B)",
|
||||
"windowTitleBar.showSidebar": "Show Sidebar (Ctrl+B)",
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
"app.sitemapGenerationFailed": "La generación del sitemap falló",
|
||||
"app.calendarRegenerationFailed": "La regeneración del calendario falló",
|
||||
"app.uploadSiteFailed": "Error al subir el sitio",
|
||||
"app.uploadSiteOfflineMode": "La subida del sitio no está disponible en modo avión.",
|
||||
"app.uploadSiteNoCredentials": "Configure primero las credenciales SSH en Configuración.",
|
||||
"app.previewOpenFailed": "No se pudo abrir la vista previa de la entrada seleccionada",
|
||||
"app.metadataDiff": "Diferencia de Metadatos",
|
||||
@@ -314,6 +315,7 @@
|
||||
"gitSidebar.error.loadRepoStatus": "No se pudo cargar el estado del repositorio.",
|
||||
"gitSidebar.error.initFailed": "No se pudo inicializar el repositorio Git.",
|
||||
"gitSidebar.error.actionFailed": "No se pudo {action}.",
|
||||
"gitSidebar.error.offlineMode": "Esta acción no está disponible en modo avión.",
|
||||
"gitSidebar.error.commitFailed": "No se pudieron confirmar los cambios.",
|
||||
"gitSidebar.progress.preparingInit": "Preparando inicialización del repositorio...",
|
||||
"gitSidebar.progress.pushingRemote": "Enviando commits al remoto... esto puede tardar con cargas grandes.",
|
||||
@@ -742,6 +744,7 @@
|
||||
"settings.ai.providerOpenCode": "OpenCode",
|
||||
"settings.ai.providerMistral": "Mistral",
|
||||
"settings.ai.providerOllama": "Ollama (Local)",
|
||||
"settings.ai.providerLmstudio": "LM Studio (Local)",
|
||||
"settings.ai.providerOther": "Otro",
|
||||
"settings.ai.ollamaLabel": "Ollama (Modelos locales)",
|
||||
"settings.ai.ollamaDescription": "Conéctate a una instancia local de Ollama para usar modelos de IA locales.",
|
||||
@@ -756,6 +759,28 @@
|
||||
"settings.toast.modelCatalogRefreshFailed": "No se pudo actualizar el catálogo",
|
||||
"settings.toast.ollamaEnabled": "Ollama activado",
|
||||
"settings.toast.ollamaDisabled": "Ollama desactivado",
|
||||
"settings.ai.lmstudioLabel": "LM Studio (Modelos locales)",
|
||||
"settings.ai.lmstudioDescription": "Conéctate a una instancia local de LM Studio para usar modelos de IA locales.",
|
||||
"settings.ai.lmstudioEnable": "Activar LM Studio",
|
||||
"settings.ai.lmstudioCapabilitiesDescription": "Configurar las capacidades de cada modelo LM Studio. Activar herramientas para llamadas a funciones o visión para análisis de imágenes.",
|
||||
"settings.ai.lmstudioCapModel": "Modelo",
|
||||
"settings.ai.lmstudioCapTools": "Herramientas",
|
||||
"settings.ai.lmstudioCapVision": "Visión",
|
||||
"settings.toast.lmstudioEnabled": "LM Studio activado",
|
||||
"settings.toast.lmstudioDisabled": "LM Studio desactivado",
|
||||
"settings.ai.offlineLabel": "Modo avión",
|
||||
"settings.ai.offlineDescription": "Cuando está activado, solo se usan modelos alojados localmente (Ollama, LM Studio). Los proveedores en la nube se desactivan.",
|
||||
"settings.ai.offlineEnable": "Activar modo avión",
|
||||
"settings.ai.offlineChatModel": "Modelo de chat sin conexión",
|
||||
"settings.ai.offlineChatModelDescription": "Modelo usado para conversaciones en modo avión.",
|
||||
"settings.ai.offlineTitleModel": "Modelo de título sin conexión",
|
||||
"settings.ai.offlineTitleModelDescription": "Modelo usado para generar títulos en modo avión.",
|
||||
"settings.ai.offlineImageAnalysisModel": "Modelo de análisis de imagen sin conexión",
|
||||
"settings.ai.offlineImageAnalysisModelDescription": "Modelo usado para el análisis de imágenes en modo avión.",
|
||||
"settings.ai.offlineNoLocalProviders": "No hay proveedores locales activados. Activa primero Ollama o LM Studio.",
|
||||
"settings.ai.offlineNoLocalModels": "No hay modelos locales disponibles",
|
||||
"settings.toast.offlineEnabled": "Modo avión activado",
|
||||
"settings.toast.offlineDisabled": "Modo avión desactivado",
|
||||
"settings.publishing.sshHostDescription": "Nombre de host o IP del servidor SSH.",
|
||||
"settings.publishing.sshUsernameDescription": "Nombre de usuario de SSH.",
|
||||
"settings.publishing.sshRemotePathDescription": "El directorio de destino en el servidor remoto donde se publicará tu blog.",
|
||||
@@ -891,6 +916,9 @@
|
||||
"statusBar.theme": "Tema: {theme}",
|
||||
"statusBar.ui": "UI",
|
||||
"statusBar.uiLanguage": "Idioma de la interfaz",
|
||||
"statusBar.offlineMode": "Modo avión",
|
||||
"statusBar.offlineModeActive": "Modo avión (activo)",
|
||||
"statusBar.offlineModeTooltip": "Haz clic para activar/desactivar el modo avión",
|
||||
"windowTitleBar.toggleSidebar": "Alternar barra lateral",
|
||||
"windowTitleBar.hideSidebar": "Ocultar barra lateral",
|
||||
"windowTitleBar.showSidebar": "Mostrar barra lateral",
|
||||
|
||||
@@ -32,8 +32,11 @@
|
||||
"app.databaseRebuildFailed": "Échec de la reconstruction de la base de données",
|
||||
"app.textReindexFailed": "Échec de la réindexation du texte",
|
||||
"app.sitemapGenerationFailed": "Échec de la génération du sitemap",
|
||||
"app.calendarRegenerationFailed": "Échec de la régénération du calendrier", "app.uploadSiteFailed": "Échec de la publication du site",
|
||||
"app.uploadSiteNoCredentials": "Veuillez d'abord configurer les identifiants SSH dans les paramètres.", "app.previewOpenFailed": "Impossible d’ouvrir l’aperçu de l’article sélectionné",
|
||||
"app.calendarRegenerationFailed": "Échec de la régénération du calendrier",
|
||||
"app.uploadSiteFailed": "Échec de la publication du site",
|
||||
"app.uploadSiteOfflineMode": "La publication du site est bloquée en mode avion.",
|
||||
"app.uploadSiteNoCredentials": "Veuillez d'abord configurer les identifiants SSH dans les paramètres.",
|
||||
"app.previewOpenFailed": "Impossible d’ouvrir l’aperçu de l’article sélectionné",
|
||||
"app.metadataDiff": "Diff Métadonnées",
|
||||
"app.importComplete": "Import terminé : {posts} articles, {media} fichiers média",
|
||||
"siteValidation.tabTitle": "Validation du site",
|
||||
@@ -312,6 +315,7 @@
|
||||
"gitSidebar.error.loadRepoStatus": "Impossible de charger l’état du dépôt.",
|
||||
"gitSidebar.error.initFailed": "Impossible d’initialiser le dépôt Git.",
|
||||
"gitSidebar.error.actionFailed": "Échec de {action}.",
|
||||
"gitSidebar.error.offlineMode": "Cette action est bloquée en mode avion.",
|
||||
"gitSidebar.error.commitFailed": "Impossible de valider les modifications.",
|
||||
"gitSidebar.progress.preparingInit": "Préparation de l’initialisation du dépôt...",
|
||||
"gitSidebar.progress.pushingRemote": "Envoi des commits vers le distant... cela peut prendre un moment pour les gros envois.",
|
||||
@@ -740,6 +744,7 @@
|
||||
"settings.ai.providerOpenCode": "OpenCode",
|
||||
"settings.ai.providerMistral": "Mistral",
|
||||
"settings.ai.providerOllama": "Ollama (Local)",
|
||||
"settings.ai.providerLmstudio": "LM Studio (Local)",
|
||||
"settings.ai.providerOther": "Autre",
|
||||
"settings.ai.ollamaLabel": "Ollama (Modèles locaux)",
|
||||
"settings.ai.ollamaDescription": "Connectez-vous à une instance Ollama locale pour utiliser des modèles d'IA locaux.",
|
||||
@@ -754,6 +759,28 @@
|
||||
"settings.toast.modelCatalogRefreshFailed": "Échec de l'actualisation du catalogue",
|
||||
"settings.toast.ollamaEnabled": "Ollama activé",
|
||||
"settings.toast.ollamaDisabled": "Ollama désactivé",
|
||||
"settings.ai.lmstudioLabel": "LM Studio (Modèles locaux)",
|
||||
"settings.ai.lmstudioDescription": "Connectez-vous à une instance LM Studio locale pour utiliser des modèles d'IA locaux.",
|
||||
"settings.ai.lmstudioEnable": "Activer LM Studio",
|
||||
"settings.ai.lmstudioCapabilitiesDescription": "Configurer les capacités de chaque modèle LM Studio. Activer les outils pour les appels de fonctions ou la vision pour l'analyse d'images.",
|
||||
"settings.ai.lmstudioCapModel": "Modèle",
|
||||
"settings.ai.lmstudioCapTools": "Outils",
|
||||
"settings.ai.lmstudioCapVision": "Vision",
|
||||
"settings.toast.lmstudioEnabled": "LM Studio activé",
|
||||
"settings.toast.lmstudioDisabled": "LM Studio désactivé",
|
||||
"settings.ai.offlineLabel": "Mode avion",
|
||||
"settings.ai.offlineDescription": "Lorsqu'il est activé, seuls les modèles hébergés localement (Ollama, LM Studio) sont utilisés. Les fournisseurs cloud sont désactivés.",
|
||||
"settings.ai.offlineEnable": "Activer le mode avion",
|
||||
"settings.ai.offlineChatModel": "Modèle de chat hors ligne",
|
||||
"settings.ai.offlineChatModelDescription": "Modèle utilisé pour les conversations en mode avion.",
|
||||
"settings.ai.offlineTitleModel": "Modèle de titre hors ligne",
|
||||
"settings.ai.offlineTitleModelDescription": "Modèle utilisé pour la génération de titres en mode avion.",
|
||||
"settings.ai.offlineImageAnalysisModel": "Modèle d'analyse d'image hors ligne",
|
||||
"settings.ai.offlineImageAnalysisModelDescription": "Modèle utilisé pour l'analyse d'images en mode avion.",
|
||||
"settings.ai.offlineNoLocalProviders": "Aucun fournisseur local activé. Activez d'abord Ollama ou LM Studio.",
|
||||
"settings.ai.offlineNoLocalModels": "Aucun modèle local disponible",
|
||||
"settings.toast.offlineEnabled": "Mode avion activé",
|
||||
"settings.toast.offlineDisabled": "Mode avion désactivé",
|
||||
"settings.publishing.sshHostDescription": "Nom d'hôte ou IP du serveur SSH.",
|
||||
"settings.publishing.sshUsernameDescription": "Nom d'utilisateur SSH.",
|
||||
"settings.publishing.sshRemotePathDescription": "Le répertoire de destination sur le serveur distant où votre blog sera publié.",
|
||||
@@ -889,6 +916,9 @@
|
||||
"statusBar.theme": "Thème : {theme}",
|
||||
"statusBar.ui": "UI",
|
||||
"statusBar.uiLanguage": "Langue de l’interface",
|
||||
"statusBar.offlineMode": "Mode avion",
|
||||
"statusBar.offlineModeActive": "Mode avion (actif)",
|
||||
"statusBar.offlineModeTooltip": "Cliquer pour basculer le mode avion",
|
||||
"windowTitleBar.toggleSidebar": "Basculer la barre latérale",
|
||||
"windowTitleBar.hideSidebar": "Masquer la barre latérale",
|
||||
"windowTitleBar.showSidebar": "Afficher la barre latérale",
|
||||
@@ -1005,9 +1035,7 @@
|
||||
"importAnalysis.usedIn": "Utilisé dans : {items}{more}",
|
||||
"importAnalysis.moreSuffix": ", +{count} de plus",
|
||||
"importAnalysis.noParameters": "(aucun paramètre)",
|
||||
|
||||
"sidebar.nav.mcp": "Serveur MCP",
|
||||
|
||||
"settings.mcp.title": "Serveur MCP",
|
||||
"settings.mcp.description": "Configurez le serveur Model Context Protocol qui permet aux agents de programmation IA d'interagir avec votre blog.",
|
||||
"settings.mcp.statusLabel": "État du serveur",
|
||||
|
||||
@@ -32,8 +32,11 @@
|
||||
"app.databaseRebuildFailed": "Ricostruzione database non riuscita",
|
||||
"app.textReindexFailed": "Reindicizzazione testo non riuscita",
|
||||
"app.sitemapGenerationFailed": "Generazione sitemap non riuscita",
|
||||
"app.calendarRegenerationFailed": "Rigenerazione del calendario non riuscita", "app.uploadSiteFailed": "Caricamento del sito non riuscito",
|
||||
"app.uploadSiteNoCredentials": "Configurare prima le credenziali SSH nelle impostazioni.", "app.previewOpenFailed": "Impossibile aprire l’anteprima del post selezionato",
|
||||
"app.calendarRegenerationFailed": "Rigenerazione del calendario non riuscita",
|
||||
"app.uploadSiteFailed": "Caricamento del sito non riuscito",
|
||||
"app.uploadSiteOfflineMode": "Il caricamento del sito non è disponibile in modalità aereo.",
|
||||
"app.uploadSiteNoCredentials": "Configurare prima le credenziali SSH nelle impostazioni.",
|
||||
"app.previewOpenFailed": "Impossibile aprire l’anteprima del post selezionato",
|
||||
"app.metadataDiff": "Diff Metadati",
|
||||
"app.importComplete": "Import completato: {posts} post, {media} file multimediali",
|
||||
"siteValidation.tabTitle": "Validazione sito",
|
||||
@@ -312,6 +315,7 @@
|
||||
"gitSidebar.error.loadRepoStatus": "Impossibile caricare lo stato del repository.",
|
||||
"gitSidebar.error.initFailed": "Impossibile inizializzare il repository Git.",
|
||||
"gitSidebar.error.actionFailed": "Impossibile {action}.",
|
||||
"gitSidebar.error.offlineMode": "Questa azione non è disponibile in modalità aereo.",
|
||||
"gitSidebar.error.commitFailed": "Impossibile eseguire il commit delle modifiche.",
|
||||
"gitSidebar.progress.preparingInit": "Preparazione inizializzazione repository...",
|
||||
"gitSidebar.progress.pushingRemote": "Invio dei commit al remoto... può richiedere tempo per upload grandi.",
|
||||
@@ -740,6 +744,7 @@
|
||||
"settings.ai.providerOpenCode": "OpenCode",
|
||||
"settings.ai.providerMistral": "Mistral",
|
||||
"settings.ai.providerOllama": "Ollama (Locale)",
|
||||
"settings.ai.providerLmstudio": "LM Studio (Locale)",
|
||||
"settings.ai.providerOther": "Altro",
|
||||
"settings.ai.ollamaLabel": "Ollama (Modelli locali)",
|
||||
"settings.ai.ollamaDescription": "Connettiti a un'istanza Ollama locale per utilizzare modelli IA locali.",
|
||||
@@ -754,6 +759,28 @@
|
||||
"settings.toast.modelCatalogRefreshFailed": "Aggiornamento del catalogo non riuscito",
|
||||
"settings.toast.ollamaEnabled": "Ollama attivato",
|
||||
"settings.toast.ollamaDisabled": "Ollama disattivato",
|
||||
"settings.ai.lmstudioLabel": "LM Studio (Modelli locali)",
|
||||
"settings.ai.lmstudioDescription": "Connettiti a un'istanza LM Studio locale per utilizzare modelli IA locali.",
|
||||
"settings.ai.lmstudioEnable": "Attiva LM Studio",
|
||||
"settings.ai.lmstudioCapabilitiesDescription": "Configura le capacità per ogni modello LM Studio. Attiva gli strumenti per le chiamate a funzioni o la visione per l'analisi delle immagini.",
|
||||
"settings.ai.lmstudioCapModel": "Modello",
|
||||
"settings.ai.lmstudioCapTools": "Strumenti",
|
||||
"settings.ai.lmstudioCapVision": "Visione",
|
||||
"settings.toast.lmstudioEnabled": "LM Studio attivato",
|
||||
"settings.toast.lmstudioDisabled": "LM Studio disattivato",
|
||||
"settings.ai.offlineLabel": "Modalità aereo",
|
||||
"settings.ai.offlineDescription": "Quando attivato, vengono utilizzati solo i modelli ospitati localmente (Ollama, LM Studio). I provider cloud sono disabilitati.",
|
||||
"settings.ai.offlineEnable": "Attiva modalità aereo",
|
||||
"settings.ai.offlineChatModel": "Modello chat offline",
|
||||
"settings.ai.offlineChatModelDescription": "Modello utilizzato per le conversazioni in modalità aereo.",
|
||||
"settings.ai.offlineTitleModel": "Modello titolo offline",
|
||||
"settings.ai.offlineTitleModelDescription": "Modello utilizzato per la generazione dei titoli in modalità aereo.",
|
||||
"settings.ai.offlineImageAnalysisModel": "Modello analisi immagini offline",
|
||||
"settings.ai.offlineImageAnalysisModelDescription": "Modello utilizzato per l'analisi delle immagini in modalità aereo.",
|
||||
"settings.ai.offlineNoLocalProviders": "Nessun provider locale attivato. Attiva prima Ollama o LM Studio.",
|
||||
"settings.ai.offlineNoLocalModels": "Nessun modello locale disponibile",
|
||||
"settings.toast.offlineEnabled": "Modalità aereo attivata",
|
||||
"settings.toast.offlineDisabled": "Modalità aereo disattivata",
|
||||
"settings.publishing.sshHostDescription": "Hostname o IP del server SSH.",
|
||||
"settings.publishing.sshUsernameDescription": "Nome utente SSH.",
|
||||
"settings.publishing.sshRemotePathDescription": "La directory di destinazione sul server remoto in cui verrà pubblicato il tuo blog.",
|
||||
@@ -889,6 +916,9 @@
|
||||
"statusBar.theme": "Tema: {theme}",
|
||||
"statusBar.ui": "UI",
|
||||
"statusBar.uiLanguage": "Lingua interfaccia",
|
||||
"statusBar.offlineMode": "Modalità aereo",
|
||||
"statusBar.offlineModeActive": "Modalità aereo (attiva)",
|
||||
"statusBar.offlineModeTooltip": "Clicca per attivare/disattivare la modalità aereo",
|
||||
"windowTitleBar.toggleSidebar": "Mostra/Nascondi barra laterale",
|
||||
"windowTitleBar.hideSidebar": "Nascondi barra laterale",
|
||||
"windowTitleBar.showSidebar": "Mostra barra laterale",
|
||||
@@ -1005,9 +1035,7 @@
|
||||
"importAnalysis.usedIn": "Usato in: {items}{more}",
|
||||
"importAnalysis.moreSuffix": ", +{count} altri",
|
||||
"importAnalysis.noParameters": "(nessun parametro)",
|
||||
|
||||
"sidebar.nav.mcp": "Server MCP",
|
||||
|
||||
"settings.mcp.title": "Server MCP",
|
||||
"settings.mcp.description": "Configura il server Model Context Protocol che permette agli agenti di programmazione IA di interagire con il tuo blog.",
|
||||
"settings.mcp.statusLabel": "Stato del server",
|
||||
|
||||
Reference in New Issue
Block a user