ComdTeX

El asistente de IA

El asistente de IA de ComdTeX es opcional y está apagado por defecto. ComdTeX no trae ninguna clave incorporada y no hace ninguna petición de red relacionada con IA hasta que tú lo activas en Configuración. Si nunca tocas esa opción, ComdTeX funciona exactamente igual que si la función no existiera.

Es un modelo “trae tu propio proveedor” (BYO, bring your own): tú eliges el proveedor, pegas tu propia clave de API (o apuntas a un modelo local) y ComdTeX habla directamente con ese proveedor.

Proveedores soportados

ProveedorQué necesitasModelo sugerido
Anthropic (Claude)Clave de API de Anthropicclaude-3-5-sonnet-latest
OpenAIClave de API de OpenAIgpt-4o-mini
Google GeminiClave de API de Googlegemini-1.5-flash
OpenAI-compatible (custom)URL base propia (DeepSeek, OpenRouter, LM Studio, Ollama local, etc.)el que ofrezca tu endpoint
CLI de agente localUn comando de terminal instalado (claude, opencode, etc.)(no aplica)

El proveedor “OpenAI-compatible” cubre cualquier servidor que hable el mismo formato que la API de chat de OpenAI, incluidos motores locales como Ollama o LM Studio que no necesitan ninguna clave.

Compruébalo antes de necesitarlo

En Ajustes hay un botón Probar conexión junto a los campos de IA. Envía la petición real más pequeña posible y te dice cuál de cuatro cosas está mal, porque todas se ven iguales hasta que algo se envía de verdad:

Lo que diceQué arreglar
El proveedor rechazó la claveLa clave falta, venció, o es de otro proveedor
El proveedor no tiene ese modeloEl nombre del modelo, tal cual lo escribe ese proveedor
No hubo respuestaLa dirección, y si es local, que el servicio esté encendido
Esa dirección no se permiteUsa https:// o una dirección local

Cuando un mensaje falle después, el asistente nombra las mismas causas de la misma manera.

Cualquier proveedor, no una lista fija

ComdTeX llega a tu proveedor por la capa de escritorio, no por la del navegador, así que sirve cualquier endpoint accesible por https://, incluido uno que alojes tú. Las versiones anteriores solo permitían un puñado de hosts fijos, y apuntar a otro fallaba sin nada útil que mostrar.

La regla de seguridad no cambió, y es sobre tu clave más que sobre una lista de hosts: una dirección que no sea https:// ni local se rechaza antes de enviar la clave.

Dónde se guarda la clave de API

La clave de API que pegas en Configuración se guarda en el llavero del sistema operativo (keychain), no en el archivo de configuración normal de ComdTeX ni junto al resto de tus preferencias. Si una versión antigua guardó la clave en otro sitio, ComdTeX la migra automáticamente al llavero la primera vez que abres la app.

Dos formas de usarlo

El panel de IA (Ctrl+Shift+A)

Abre una conversación lateral con contexto del archivo o la selección activa. Puedes pedir explicaciones, reescrituras, resúmenes o cualquier tarea de escritura, y aplicar el resultado al documento.

Edición en línea (Ctrl+K)

Selecciona texto (o coloca el cursor donde quieras insertar algo), pulsa Ctrl+K, describe el cambio en una frase, y el resultado sustituye la selección o se inserta en el cursor.

En ambos casos, ComdTeX antepone un contexto interno que enseña al modelo la sintaxis propia de ComdTeX (shorthands, entornos, ::: bloques especiales), así que las respuestas llegan en Markdown+LaTeX correcto para la app, no en un formato genérico.

Toda edición pasa por el editor

Esto es una garantía de diseño, no un detalle menor: ninguna edición de IA escribe directamente en disco. Todo cambio (el panel, la edición en línea, o el relleno de huecos que ves más abajo) se aplica a través del editor Monaco, exactamente como si lo hubieras escrito tú.

Consecuencias prácticas:

  • Ctrl+Z deshace cualquier cambio de IA, tal cual deshace cualquier otra edición.
  • ComdTeX nunca sobrescribe un archivo por su cuenta ni “silenciosamente”: si no ves el cambio en el editor, no ha pasado.
  • El autoguardado normal se encarga de persistir el resultado, con el mismo comportamiento (y los mismos huecos de tiempo) que una edición manual.

Huecos {{?}}: rellenar bajo demanda

Puedes dejar marcadores explícitos mientras escribes y rellenarlos después, en vez de que la IA te interrumpa con autocompletado fantasma:

:::definition
Una función es continua en $a$ cuando {{? define continuidad con épsilon-delta}}
:::

El teorema fundamental dice que {{?}}
  • {{?}}: hueco sin pista, la IA deduce del contexto qué escribir.
  • {{? una pista}}: con una indicación de qué quieres, hasta el }}.

Se insertan con Ctrl+P → “Insertar hueco {{?}}”, y se rellenan con Ctrl+P → “Completar hueco con IA” (el que tiene el cursor encima) o “Completar todos los huecos con IA” (todo el documento). Requiere el asistente activado y configurado, igual que el resto de funciones de IA.

Un {{?}} dentro de un bloque de código (```) se ignora: ahí es documentación sobre la sintaxis, no una petición real. Solo se envía al modelo el bloque alrededor del hueco (unas 12 líneas a cada lado) más tu pista, nunca el documento entero.

Esto no es autocompletado tipo Copilot: tú decides exactamente dónde puede escribir la IA, no se genera nada hasta que lo pides explícitamente, y la tecla Tab sigue libre para expandir shorthands, que es el atajo central de ComdTeX.

Validación de la URL base (protección SSRF)

Si usas el proveedor “OpenAI-compatible” con tu propia URL, ComdTeX solo acepta:

  • https://, cualquier origen, o
  • http://localhost / http://127.0.0.1 (loopback), para motores locales como Ollama.

Cualquier otra combinación (por ejemplo http:// hacia un host remoto) se rechaza antes de enviar la clave de API. Esto evita que una URL mal escrita o maliciosa termine filtrando tu clave a un servidor arbitrario.

Cómo usar un modelo local con Ollama

  1. Instala y arranca Ollama y descarga un modelo, por ejemplo ollama pull llama3.1.
  2. En ComdTeX, abre Configuración → Asistente IA y activa el interruptor principal.
  3. Elige el proveedor OpenAI-compatible (custom).
  4. Como URL base, escribe http://localhost:11434/v1.
  5. Como modelo, escribe el nombre exacto que descargaste, por ejemplo llama3.1.
  6. No hace falta ninguna clave de API para Ollama; el campo puede quedar vacío.
  7. Abre el panel de IA (Ctrl+Shift+A) o prueba una edición en línea (Ctrl+K) para confirmar que responde.

Todo esto corre en tu máquina: ninguna petición sale a Internet.

The AI assistant

ComdTeX’s AI assistant is optional and off by default. ComdTeX ships no built-in keys and makes no AI-related network request until you enable it in Settings. If you never touch that toggle, ComdTeX behaves exactly as if the feature did not exist.

It is a “bring your own provider” (BYO) model: you choose the provider, paste your own API key (or point at a local model), and ComdTeX talks directly to that provider.

Supported providers

ProviderWhat you needSuggested model
Anthropic (Claude)Anthropic API keyclaude-3-5-sonnet-latest
OpenAIOpenAI API keygpt-4o-mini
Google GeminiGoogle API keygemini-1.5-flash
OpenAI-compatible (custom)Your own base URL (DeepSeek, OpenRouter, LM Studio, local Ollama, etc.)whatever your endpoint offers
Local agent CLIAn installed terminal command (claude, opencode, etc.)(not applicable)

The “OpenAI-compatible” preset covers any server that speaks the same shape as the OpenAI chat API, including local engines like Ollama or LM Studio that need no key at all.

Check it works before you need it

Settings has a Test connection button next to the AI fields. It sends the smallest possible real request and tells you which of four things is wrong, because they all look identical until something is actually sent:

What it saysWhat to fix
The provider refused the keyThe key is missing, expired, or belongs to a different provider
The provider does not have that modelThe model name, exactly as that provider spells it
No answer at allThe address, and whether the service is running if it is local
That address is not allowedUse https:// or a local address

When a message fails later, the assistant names the same causes the same way.

Any provider, not a fixed list

ComdTeX reaches your provider through the desktop layer, not the browser layer, so any endpoint reachable over https:// works, including one you host yourself. Earlier versions permitted only a handful of hard-coded hosts, and pointing at anything else failed with nothing useful to show for it.

The safety rule is unchanged, and it is about your key rather than about the host list: an address that is neither https:// nor a local address is refused before the key is ever sent.

Check it works before you need it

Settings has a Test connection button next to the AI fields. It sends the smallest possible real request and tells you which of four things is wrong, because they all look identical until something is actually sent:

What it saysWhat to fix
The provider refused the keyThe key is missing, expired, or belongs to a different provider
The provider does not have that modelThe model name, exactly as that provider spells it
No answer at allThe address, and whether the service is running if it is local
That address is not allowedUse https:// or a local address

When a message fails later, the assistant names the same causes the same way.

Any provider, not a fixed list

ComdTeX reaches your provider through the desktop layer, not the browser layer, so any endpoint reachable over https:// works, including one you host yourself. Earlier versions permitted only a handful of hard-coded hosts, and pointing at anything else failed with nothing useful to show for it.

The safety rule is unchanged, and it is about your key rather than about the host list: an address that is neither https:// nor a local address is refused before the key is ever sent.

Where the API key is stored

The API key you paste in Settings is stored in the OS keychain, not in ComdTeX’s regular configuration file alongside your other preferences. If an older build stored the key somewhere else, ComdTeX migrates it into the keychain automatically the first time you open the app.

Two entry points

The AI panel (Ctrl+Shift+A)

Opens a side conversation with context from the active file or selection. Ask for explanations, rewrites, summaries, or any writing task, and apply the result to the document.

Inline edit (Ctrl+K)

Select text (or place the cursor where you want something inserted), press Ctrl+K, describe the change in a sentence, and the result replaces the selection or is inserted at the cursor.

In both cases, ComdTeX prepends an internal context that teaches the model ComdTeX’s own syntax (shorthands, environments, ::: special blocks), so responses arrive as correct Markdown+LaTeX for the app, not a generic format.

Every AI edit goes through the editor

This is a design guarantee, not a minor detail: no AI edit ever writes directly to disk. Every change (the panel, inline edit, or the gap filling described below) is applied through the Monaco editor, exactly as if you had typed it yourself.

Practical consequences:

  • Ctrl+Z undoes any AI change, just as it undoes any other edit.
  • ComdTeX never overwrites a file on its own or silently: if you don’t see the change in the editor, it hasn’t happened.
  • Regular autosave persists the result, with the same behavior (and the same timing) as a manual edit.

{{?}} gaps: fill on demand

You can leave explicit markers while writing and fill them later, instead of the AI interrupting you with ghost-text autocompletion:

:::definition
A function is continuous at $a$ when {{? define continuity with epsilon-delta}}
:::

The fundamental theorem states that {{?}}
  • {{?}}: a bare gap; the AI infers what to write from context.
  • {{? a hint}}: with a hint of what you want, up to the }}.

Insert one with Ctrl+P → “Insert gap {{?}}”, and fill with Ctrl+P → “Complete gap with AI” (the one under the cursor) or “Complete all gaps with AI” (the whole document). Requires the assistant enabled and configured, like every other AI feature.

A {{?}} inside a fenced code block (```) is ignored: there it is syntax documentation, not an actual request. Only the block around the gap (about 12 lines on each side) plus your hint is sent to the model, never the whole document.

This is not Copilot-style autocompletion: you decide exactly where the AI is allowed to write, nothing is generated until you explicitly ask for it, and the Tab key stays free to expand shorthands, ComdTeX’s central shortcut.

Base URL validation (SSRF protection)

If you use the “OpenAI-compatible” provider with your own URL, ComdTeX only accepts:

  • https://, any origin, or
  • http://localhost / http://127.0.0.1 (loopback), for local engines like Ollama.

Any other combination (for example http:// to a remote host) is rejected before your API key is ever sent. This prevents a mistyped or malicious URL from leaking your key to an arbitrary server.

How to use a local model with Ollama

  1. Install and start Ollama and pull a model, for example ollama pull llama3.1.
  2. In ComdTeX, open Settings → AI assistant and turn on the master switch.
  3. Choose the OpenAI-compatible (custom) provider.
  4. As the base URL, enter http://localhost:11434/v1.
  5. As the model, enter the exact name you pulled, for example llama3.1.
  6. No API key is needed for Ollama; the field can stay empty.
  7. Open the AI panel (Ctrl+Shift+A) or try an inline edit (Ctrl+K) to confirm it responds.

All of this runs on your machine: no request ever leaves it.