mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-20 15:14:20 +01:00
refactor: cleanup
This commit is contained in:
17
dev_gpt/options/generate/prompt_factory.py
Normal file
17
dev_gpt/options/generate/prompt_factory.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user