Skip to content
Merged

Dev #216

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<a href="https://github.com/JE-Chen/je_editor/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/JE-Chen/je_editor" alt="License"/>
</a>
<a href="https://je-editor.readthedocs.io/en/latest/">
<img src="https://img.shields.io/readthedocs/je-editor" alt="Read the Docs"/>
</a>
</p>

<p align="center">
Expand Down
3 changes: 3 additions & 0 deletions README/README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<a href="https://github.com/JE-Chen/je_editor/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/JE-Chen/je_editor" alt="License"/>
</a>
<a href="https://je-editor.readthedocs.io/en/latest/">
<img src="https://img.shields.io/readthedocs/je-editor" alt="Read the Docs"/>
</a>
</p>

<p align="center">
Expand Down
3 changes: 3 additions & 0 deletions README/README_zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<a href="https://github.com/JE-Chen/je_editor/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/JE-Chen/je_editor" alt="License"/>
</a>
<a href="https://je-editor.readthedocs.io/en/latest/">
<img src="https://img.shields.io/readthedocs/je-editor" alt="Read the Docs"/>
</a>
</p>

<p align="center">
Expand Down
36 changes: 8 additions & 28 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
from pathlib import Path
Expand All @@ -20,37 +13,24 @@

# -- Project information -----------------------------------------------------


project = "JEditor"
copyright = "2020 ~ Now, JE-Chen"
copyright = "2021 ~ Present, JE-Chen"

Check warning on line 17 in docs/source/conf.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/source/conf.py#L17

Redefining built-in 'copyright'
author = "JE-Chen"

# The full version, including alpha/beta/rc tags
release = "0.0.0.1"
release = "1.0.10"

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

# -- Internationalization ----------------------------------------------------

locale_dirs = ["locale/"]
gettext_compact = False
59 changes: 59 additions & 0 deletions docs/source/docs/Eng/ai_assistant.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
AI Assistant
=============

JEditor integrates an AI-powered chat assistant using `LangChain <https://www.langchain.com/>`_
and OpenAI-compatible APIs. The AI panel allows you to have conversations with a large language
model directly within the editor.

Setup
------

Before using the AI assistant, you need to configure it:

1. Open the AI configuration dialog from the menu
2. Set the following parameters:

.. list-table::
:header-rows: 1
:widths: 25 75

* - Setting
- Description
* - **API Base URL**
- The API endpoint (e.g., ``https://api.openai.com/v1``)
* - **API Key**
- Your OpenAI API key
* - **Model**
- The model to use (e.g., ``gpt-3.5-turbo``, ``gpt-4``, or any custom model)
* - **System Prompt**
- A template that sets the AI's behavior and context

Configuration is saved to ``.jeditor/ai_config.json`` and persists between sessions.

You can also configure the API key via environment variables.

Chat Interface
---------------

The AI chat panel provides:

- **Message history** — Scrollable chat history with all previous messages
- **Input field** — Type your prompt at the bottom of the panel
- **Font size adjustment** — Customize the chat panel's font size
- **Read-only message area** — Chat history is displayed in a read-only area

Async Communication
--------------------

AI requests are handled asynchronously to keep the editor responsive:

- Messages are sent to the AI in a background thread
- Responses are pulled back using a configurable timer interval
- A message queue ensures orderly communication
- The UI remains fully interactive while waiting for responses

Error Handling
---------------

If the AI request fails (e.g., network error, invalid API key), JEditor shows a clear error
dialog describing the problem. The chat session continues to work after resolving the issue.
Loading
Loading