Skip to content

v1.1.0 — AI Inline Ghost Text Completion

Choose a tag to compare

@xezpeleta xezpeleta released this 27 Jun 10:57

🆕 AI Inline Completion

Copilot-style ghost text completions, powered by any OpenAI-compatible API.

✨ Features

  • Pluggable providerAiCompletionProvider.fetchCompletion(context, signal) works with OpenAI, Ollama, Groq, LM Studio, or your own backend
  • Ghost text — dimmed inline suggestion after the cursor
  • Tab to accept, Escape to dismiss
  • Debounced — configurable debounceMs, auto-cancels in-flight requests on new input
  • Staleness-safe — completions from old document states are discarded
  • Opt-in — disabled by default, enable via extensions.aiCompletion in config

📦 Usage

new IdaztianEditor({
  parent: document.getElementById('editor'),
  extensions: {
    aiCompletion: {
      provider: {
        async fetchCompletion(context, signal) {
          const res = await fetch('https://api.openai.com/v1/chat/completions', {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json',
              'Authorization': `Bearer ${API_KEY}`,
            },
            body: JSON.stringify({
              model: 'gpt-4o-mini',
              messages: [
                { role: 'system', content: 'Continue the text naturally. Output ONLY the continuation.' },
                { role: 'user', content: context },
              ],
              max_tokens: 150,
            }),
            signal,
          });
          const data = await res.json();
          return data.choices?.[0]?.message?.content?.trim() || null;
        },
      },
      debounceMs: 500,
    },
  },
});

📄 Documentation

  • Updated README with full AI completion example
  • New CHANGELOG.md with full release history
  • Updated landing page with AI Autocompletion feature card

Full Changelog: v1.0.4...v1.1.0