in src/models/struxgpt_v2.py [0:0]
def __str__(self) -> str:
if not self.valid:
return f'Invalid item: {self.dict}'
if self.scfg and self.scfg.format_type == 'JSON':
s = json.dumps(self.to_json(disp=True), indent=2, ensure_ascii=False)
pattern = r"\[([\s\d\,]*)]"
for x in re.findall(pattern, s):
s = s.replace(x, ' '.join(x.split()))
s = f'```json\n{s}```'
else: # default
s = self.to_yaml()
s = f'```yaml\n{s}```'
return s