Enhance LLM functionality with PRO mode support and improved prompt handling

- Added support for PRO mode in LLM with specific instruction handling and context awareness.
- Updated prompt building functions to include prefill options for better context management.
- Introduced new inline examples for PRO mode in JSON format.
- Enhanced system prompts to reflect PRO mode capabilities and rules.
- Modified API endpoints to accommodate new parameters and ensure backward compatibility.
- Improved test cases to validate new functionality and ensure comprehensive coverage.
This commit is contained in:
“ydy0615”
2026-06-02 21:23:34 +08:00
parent b82c6d392d
commit 2c7a02f587
12 changed files with 191 additions and 70 deletions
+9 -6
View File
@@ -56,19 +56,22 @@ def test_pro_status_missing_returns_404():
assert response.status_code == 404
def test_pro_prompt_uses_simple_chat_instruction():
def test_pro_prompt_uses_pro_specific_instruction():
system_prompt, user_prompt = pro_completions._build_pro_prompts(
prefix="欢迎使用 LLM-IN-TEXT\n\n即时可用的 LLM 系统",
suffix="",
language_id="markdown",
instruction="",
pro_thinking="high",
)
combined = f"{system_prompt}\n{user_prompt}".lower()
assert "pro block" not in combined
assert "replacement" not in combined
assert "final answer" not in combined
assert "markdown before cursor" in combined
assert "markdown after cursor" in combined
assert "[pro] model for llm-in-text" in combined
assert "pro_mode: true" in combined
assert "pro_thinking_level: high" in combined
assert "long paragraphs or section-level output are allowed" in combined
assert "highest priority" in combined
assert "never copy tags to output" in combined
assert "write only the markdown that belongs at the cursor" not in combined
assert "continue the markdown naturally" in combined