feat: Add LOCAL variable support for responses with UTF-8 JSON encoding.
Description: This feature adds support for UTF-8 encoding in JSON responses, allowing for proper handling of special characters and emojis. - Implement unit tests for UTF-8 encoding in various model providers including Gemini, OpenAI, and OpenAI Compatible. - Validate UTF-8 support in token counting, content generation, and error handling. - Introduce tests for JSON serialization ensuring proper handling of French characters and emojis. - Create tests for language instruction generation based on locale settings. - Validate UTF-8 handling in workflow tools including AnalyzeTool, CodereviewTool, and DebugIssueTool. - Ensure that all tests check for correct UTF-8 character preservation and proper JSON formatting. - Add integration tests to verify the interaction between locale settings and model responses.
This commit is contained in:
@@ -125,7 +125,7 @@ class DataProcessorManager:
|
||||
# Code smell: Duplicate date formatting logic
|
||||
if output_format == 'json':
|
||||
processed_data['processed_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
result = json.dumps(processed_data)
|
||||
result = json.dumps(processed_data, ensure_ascii=False)
|
||||
elif output_format == 'csv':
|
||||
processed_data['processed_at'] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
result = f"{processed_data['full_name']},{processed_data['email_domain']},{processed_data['age_category']}"
|
||||
@@ -580,7 +580,7 @@ class UserData:
|
||||
self.logger.error("Missing expert_analysis in final response")
|
||||
return False
|
||||
expert_analysis = response_final_data.get("expert_analysis", {})
|
||||
analysis_content = json.dumps(expert_analysis).lower()
|
||||
analysis_content = json.dumps(expert_analysis, ensure_ascii=False).lower()
|
||||
elif actual_status == "files_required_to_continue":
|
||||
# For files_required_to_continue, analysis is in content field
|
||||
if "content" not in response_final_data:
|
||||
@@ -708,7 +708,7 @@ def format_output(data, format_type):
|
||||
\"\"\"Format output - duplicate logic\"\"\"
|
||||
if format_type == 'json':
|
||||
import json
|
||||
return json.dumps(data)
|
||||
return json.dumps(data, ensure_ascii=False)
|
||||
elif format_type == 'csv':
|
||||
return ','.join(str(v) for v in data.values())
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user