This commit is contained in:
Timothy J. Baek 2024-08-25 18:42:27 +02:00
parent 814473878f
commit f568389235

View File

@ -127,10 +127,63 @@ def save_config():
log.exception(e) log.exception(e)
DEFAULT_CONFIG = {
"version": 0,
"ui": {
"default_locale": "",
"prompt_suggestions": [
{
"title": [
"Help me study",
"vocabulary for a college entrance exam",
],
"content": "Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option.",
},
{
"title": [
"Give me ideas",
"for what to do with my kids' art",
],
"content": "What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter.",
},
{
"title": ["Tell me a fun fact", "about the Roman Empire"],
"content": "Tell me a random fun fact about the Roman Empire",
},
{
"title": [
"Show me a code snippet",
"of a website's sticky header",
],
"content": "Show me a code snippet of a website's sticky header in CSS and JavaScript.",
},
{
"title": [
"Explain options trading",
"if I'm familiar with buying and selling stocks",
],
"content": "Explain options trading in simple terms if I'm familiar with buying and selling stocks.",
},
{
"title": ["Overcome procrastination", "give me tips"],
"content": "Could you start by asking me about instances when I procrastinate the most and then give me some suggestions to overcome it?",
},
{
"title": [
"Grammar check",
"rewrite it for better readability ",
],
"content": 'Check the following sentence for grammar and clarity: "[sentence]". Rewrite it for better readability while maintaining its original meaning.',
},
],
},
}
def get_config(): def get_config():
with get_db() as db: with get_db() as db:
config_entry = db.query(Config).order_by(Config.id.desc()).first() config_entry = db.query(Config).order_by(Config.id.desc()).first()
return config_entry.data if config_entry else {} return config_entry.data if config_entry else DEFAULT_CONFIG
CONFIG_DATA = get_config() CONFIG_DATA = get_config()