mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-18 22:24:21 +01:00
18 lines
357 B
Python
18 lines
357 B
Python
import json
|
|
|
|
|
|
def context_to_string(context):
|
|
context_strings = []
|
|
for k, v in context.items():
|
|
if isinstance(v, dict):
|
|
v = json.dumps(v, indent=4)
|
|
v = v.replace('{', '{{').replace('}', '}}')
|
|
context_strings.append(f'''\
|
|
{k}:
|
|
```
|
|
{v}
|
|
```
|
|
'''
|
|
)
|
|
return '\n'.join(context_strings)
|