mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-04 07:31:58 +00:00
fix(gateway): preserve underscores in plain-text identifiers
This commit is contained in:
parent
364a1dd290
commit
a3017508bf
2 changed files with 7 additions and 2 deletions
|
|
@ -168,8 +168,8 @@ class TextBatchAggregator:
|
|||
# Pre-compiled regexes for performance
|
||||
_RE_BOLD = re.compile(r"\*\*(.+?)\*\*", re.DOTALL)
|
||||
_RE_ITALIC_STAR = re.compile(r"\*(.+?)\*", re.DOTALL)
|
||||
_RE_BOLD_UNDER = re.compile(r"__(.+?)__", re.DOTALL)
|
||||
_RE_ITALIC_UNDER = re.compile(r"_(.+?)_", re.DOTALL)
|
||||
_RE_BOLD_UNDER = re.compile(r"\b__(?![\s_])(.+?)(?<![\s_])__\b", re.DOTALL)
|
||||
_RE_ITALIC_UNDER = re.compile(r"\b_(?![\s_])(.+?)(?<![\s_])_\b", re.DOTALL)
|
||||
_RE_CODE_BLOCK = re.compile(r"```[a-zA-Z0-9_+-]*\n?")
|
||||
_RE_INLINE_CODE = re.compile(r"`(.+?)`")
|
||||
_RE_HEADING = re.compile(r"^#{1,6}\s+", re.MULTILINE)
|
||||
|
|
|
|||
|
|
@ -101,6 +101,11 @@ class TestBlueBubblesHelpers:
|
|||
adapter = _make_adapter(monkeypatch)
|
||||
assert adapter.format_message("**Hello** `world`") == "Hello world"
|
||||
|
||||
def test_format_message_preserves_underscores_in_identifiers(self, monkeypatch):
|
||||
adapter = _make_adapter(monkeypatch)
|
||||
text = "Use /api_v2 with FEATURE_FLAG_NAME and config_file.json"
|
||||
assert adapter.format_message(text) == text
|
||||
|
||||
def test_strip_markdown_headers(self, monkeypatch):
|
||||
adapter = _make_adapter(monkeypatch)
|
||||
assert adapter.format_message("## Heading\ntext") == "Heading\ntext"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue