mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-26 01:12:21 +00:00
fix(errors): strip only the notice separator from client messages
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
fd0398d837
commit
2fb4391232
2 changed files with 5 additions and 2 deletions
|
|
@ -153,7 +153,10 @@ def bug_report_issue_url(report: BugReport) -> str:
|
|||
|
||||
def strip_bug_report_notice(message: str) -> str:
|
||||
index: Final = message.find(NOTICE_PREFIX)
|
||||
return message if index == -1 else message[:index].rstrip()
|
||||
if index == -1:
|
||||
return message
|
||||
head: Final = message[:index]
|
||||
return head.removesuffix("\n")
|
||||
|
||||
|
||||
def bug_report_notice(report: BugReport) -> str:
|
||||
|
|
|
|||
|
|
@ -100,5 +100,5 @@ def test_strip_bug_report_notice():
|
|||
report = build_bug_report(RuntimeError("boom"), surface="sdk")
|
||||
notice = bug_report_notice(report)
|
||||
|
||||
assert strip_bug_report_notice(f"boom\n{notice}") == "boom"
|
||||
assert strip_bug_report_notice(f"boom\n\n{notice}") == "boom\n"
|
||||
assert strip_bug_report_notice("boom") == "boom"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue