Refactor settings store to rename proModel to proThinking and update related logic; enhance CSS for energy efficiency and reduced motion preferences; improve i18n translations for better clarity and consistency; modify proBlock utility functions for clearer instruction handling; streamline Vite configuration by removing unnecessary Univer.js dependencies.

This commit is contained in:
“ydy0615”
2026-05-31 16:38:10 +08:00
parent 3a1fd1c5d7
commit b82c6d392d
42 changed files with 3909 additions and 2509 deletions
+31 -9
View File
@@ -10,7 +10,7 @@ import prompt # noqa: E402
def test_prompt_builds_system_and_user():
system_prompt, user_prompt = prompt.build_completion_prompts(
system_prompt, user_prompt, prefill = prompt.build_completion_prompts(
prefix="The result is ",
suffix="for this dataset.",
language_id="markdown",
@@ -29,14 +29,36 @@ def test_prompt_builds_system_and_user():
assert "PREFIX_ENDS_WITH_NEWLINE" in user_prompt
assert "SUFFIX_STARTS_WITH_NEWLINE" in user_prompt
assert "actual line breaks" in system_prompt
assert "start OUTPUT on a new line" in system_prompt
assert "Use real line breaks instead of spelled-out escape sequences" in user_prompt
assert "make the first character of OUTPUT a real newline" in user_prompt
assert "make the last character of OUTPUT a real newline" in user_prompt
assert "Do not explain newline or boundary choices" in user_prompt
assert "Continue after the PREFILL text" in user_prompt
assert "Step 1" not in user_prompt
assert "Does output need" not in user_prompt
assert "assistant" in system_prompt
assert "fim_middle" in system_prompt
assert prefill == ""
assert "start output with \\n" not in user_prompt
assert "Use single \\n" not in system_prompt
def test_completion_prefill_appended_to_fim_middle():
_, user_prompt, prefill = prompt.build_completion_prompts(
prefix="即时可用的 LLM 系统",
suffix="",
)
assert prefill == "系统"
assert user_prompt.endswith("<|fim_middle|>系统")
def test_completion_prefill_empty_after_newline():
_, user_prompt, prefill = prompt.build_completion_prompts(
prefix="即时可用的 LLM 系统\n",
suffix="",
)
assert prefill == ""
assert user_prompt.endswith("<|fim_middle|>")
def test_cursor_in_fence_detection():
assert prompt._cursor_in_fenced_code_block("") is False
assert prompt._cursor_in_fenced_code_block("```python\nprint('x')\n") is True
@@ -53,7 +75,7 @@ def test_active_fence_language_detection():
def test_newline_flags():
_, user_prompt_a = prompt.build_completion_prompts(
_, user_prompt_a, _ = prompt.build_completion_prompts(
prefix="Hello",
suffix="World",
)
@@ -63,7 +85,7 @@ def test_newline_flags():
assert "PREFIX_ENDS_WITH_NEWLINE: false" in user_prompt_a
assert "SUFFIX_STARTS_WITH_NEWLINE: false" in user_prompt_a
_, user_prompt_b = prompt.build_completion_prompts(
_, user_prompt_b, _ = prompt.build_completion_prompts(
prefix="Hello\n",
suffix="\nWorld",
)
@@ -73,7 +95,7 @@ def test_newline_flags():
def test_mermaid_context_flags():
_, prompt_in_mermaid = prompt.build_completion_prompts(
_, prompt_in_mermaid, _ = prompt.build_completion_prompts(
prefix="```mermaid\nflowchart TD\nA --> ",
suffix="\n```",
)
@@ -81,7 +103,7 @@ def test_mermaid_context_flags():
assert "CURSOR_FENCE_LANGUAGE: mermaid" in prompt_in_mermaid
assert "MERMAID_CONTEXT: true" in prompt_in_mermaid
_, prompt_mermaid_keyword = prompt.build_completion_prompts(
_, prompt_mermaid_keyword, _ = prompt.build_completion_prompts(
prefix="Please draw a mermaid flowchart for deploy pipeline.",
suffix="",
)
@@ -91,6 +113,6 @@ def test_mermaid_context_flags():
def test_examples_coverage():
_, user_prompt = prompt.build_completion_prompts(prefix="", suffix="")
_, user_prompt, _ = prompt.build_completion_prompts(prefix="", suffix="")
for ex in range(1, 15):
assert f"[EX{ex:02d}]" in user_prompt