AI Assistant: Контекстные правила, области применения и анализ кода
This document explains the different levels of prompts, rules, and attachment scoping used in the AI assistant to customize responses based on different contexts within the IDE, project, session, and message levels. Additionally, it introduces the feature 🧠 Code Context Analysis, which enhances the way code is sent based on the user's selection.
📚 Context Rules
The following sections define the different levels of prompts and rules applied to AI assistant queries.
-
🌐 Global Rules
Scope:IDE-wide
Description: Applied across the entire IDE environment and sent with every chat query, regardless of context.
Configure via: Tools > Options > Jeddict AI Assistant > Global Rules -
📁 Project Rules
Scope:Project-wide
Description: Applied at the project level. These rules are sent with chat queries when a file is included in the context, affecting responses relevant to the project.
Configure via: Maven Project > Right-click > Properties > Jeddict AI > Project Rules -
💬 Session Rules
Scope:Current Chat Session
Description: These rules are specific to the current chat session and are applied to every query during the session, providing context for ongoing interactions.
Configure via: AI Assistant Chat > Click "Session Context" > Session Rules -
📨 Message Rules
Scope:Per Message
Description: These rules apply only to the specific message or query you send. It represents your direct question to the AI assistant and is used to tailor the response for that individual message.
Configure via: This is the actual query you send via chat.
📎 Context Scopes
The following table defines the different levels at which attachments can be applied during a chat session with the AI assistant.
Scope | Name | Description |
---|---|---|
Chat session | 📂 Session Context Files | These files are attached during the chat session and are available throughout the duration of the session. |
Message-only | 📨 Message Context Files | These files are attached specifically to the current message or query sent by the user, providing context for that particular interaction. |
📂 Session vs 📨 Message Context Scope
📂 Session Context Files
Session Context Files are automatically determined when you start a chat and cannot be added or removed once the chat begins. They are based on where you initiate the chat:
- From a Java class: The class you selected is automatically part of the session.
- From a package: All files in the selected package become part of the session.
- From the project tree (multi-selection): All selected Java classes are included in the session.
Importance: These files are crucial because they ensure the assistant has the full context of your ongoing work. They are kept active throughout the session and are important for consistent, context-aware interactions during the chat.
📨 Message Context Files
Message Context Files are specific to a single message and won't carry over to future queries. You can manually attach them as needed:
- Drag and drop files into the query input area.
- Click the Message Context button to browse and select files.
- Smart Java Auto-Completion: The Query Pane also supports auto-completion and intelligent Java class lookup across all opened projects. By typing @ followed by a keyword (such as a class name or package), a dynamic list of matching Java classes will appear. Once selected, the fully qualified class name will be inserted into the Query Pane, and the class will automatically be added to the Message Context Files 📎.
These additions behave like manual attachments and provide precise context for the assistant’s response. 🔍 If no longer needed, you can easily remove them from the message context list with a single click, giving you full control over the scope of the current query. 🧹✅
Importance: Message context files are valuable for tailoring responses to the specifics of a single query. They allow you to provide focused context for each interaction, without affecting the session's broader context.
🧠 Code Context Analysis
Code Context Analysis allows you to control how much context is included when sending a Java class via Inline Auto Completion and Inline Hints. This helps provide more accurate and relevant suggestions from the AI based on your selected scope.
Option | What It Includes | What Is Sent |
---|---|---|
📄 Current Class | The Java class currently open and active in the editor. | Full source of the current class |
🔗 Referenced Classes | The Java class currently open and active in the editor + all referenced attribute classes | Full source of current class + public method signatures from referenced classes |
📦 Current Package | The Java class currently open and active in the editor + referenced attribute classes + all classes in the same package | Full source of current class + public method signatures from referenced and package classes |
🗃️ Entire Project | All classes in the project | Full source of current class + Only public method signatures from all classes in the project |
Note: Code Context Analysis feature only applies to inline code completion and inline hints in the Java editor. It does not apply to responses from the AI Chat Assistant. Chat responses only consider files that are explicitly attached in the session or message context.
💡 How to Use
Choose the appropriate level of context based on your needs:
- 📄 Current Class – Ideal for focused completion within the class you're editing.
- 🔗 Referenced Classes – Best when working with dependencies or helper classes.
- 📦 Current Package – Useful for contextual understanding within a module or feature set.
- 🗃️ Entire Project – Suitable for comprehensive understanding across the codebase.