File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -821,6 +821,9 @@ def extract_chat_content(response_content):
821821 line = line .strip ()
822822 if not line :
823823 continue
824+
825+ if line .startswith ("data: " ):
826+ line = line [6 :] # Remove "data: " prefix
824827 try :
825828 parsed = json .loads (line )
826829 # Non-streaming chat completion format
@@ -1576,6 +1579,16 @@ def response_checker(res, message):
15761579 for item in message .split ('\n ' ):
15771580 item = item .strip ()
15781581 if len (item ) > 0 :
1582+ if item .startswith ('data: ' ):
1583+ item = item [6 :] # Remove "data: " prefix
1584+
1585+ # Skip [DONE] markers
1586+ if item == '[DONE]' :
1587+ continue
1588+
1589+ # Skip empty items after stripping
1590+ if not item :
1591+ continue
15791592 try :
15801593 json_lines .append (json .loads (item ))
15811594 except json .JSONDecodeError as e :
@@ -1714,6 +1727,18 @@ def check_output_formatter_applied(response_text, expected_identifier):
17141727 line = line .strip ()
17151728 if not line :
17161729 continue
1730+
1731+ if line .startswith ('data: ' ):
1732+ line = line [6 :] # Remove "data: " prefix
1733+
1734+ # Skip [DONE] markers
1735+ if line == '[DONE]' :
1736+ continue
1737+
1738+ # Skip empty lines after stripping
1739+ if not line :
1740+ continue
1741+
17171742 try :
17181743 parsed_json = json .loads (line )
17191744 # Check for text completion format
You can’t perform that action at this time.
0 commit comments