Skip to content

Commit

Permalink
attempt to fix scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
ilude committed Apr 22, 2024
1 parent 47027b9 commit ecf65e9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
File renamed without changes.
17 changes: 10 additions & 7 deletions app/models/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


class Scheduler:
__scheduler = None

Expand All @@ -20,13 +16,20 @@ def shutdown():
def clear_jobs():
Scheduler.getScheduler().remove_all_jobs()

@staticmethod
def start():
Scheduler.__scheduler.start()
logging.info('Scheduler started!')

@staticmethod
def getScheduler() -> BackgroundScheduler:
if Scheduler.__scheduler == None:
Scheduler.__scheduler = BackgroundScheduler()

if os.environ.get('WERKZEUG_RUN_MAIN') == 'true':
Scheduler.__scheduler.start()
logger.info('Scheduler started!')
if bool(os.environ.get("FLASK_ENV", "development") == "development"):
if bool(os.environ.get('WERKZEUG_RUN_MAIN')):
Scheduler.start()
elif not Scheduler.__scheduler.running:
Scheduler.start()

return Scheduler.__scheduler
3 changes: 2 additions & 1 deletion app/processors/title_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def __init__(self):
user_prompt = HumanMessagePromptTemplate(prompt=prompt)

chat_prompt = ChatPromptTemplate.from_messages([system_prompt, user_prompt])
model_name = "dolphin-mistral"
#model_name = "dolphin-mistral"
model_name = "dolphin-llama3"
model_temp = 0.2
model = Ollama(base_url=self.ollama_url, model=model_name, keep_alive=5, temperature=model_temp)
self.chain = chat_prompt | model | parser
Expand Down
8 changes: 4 additions & 4 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<title>{{ site_title }}</title>

<meta name="author" content="iLude">
<meta name="description" content="Homepage">
<meta name="description" content="{{ site_title }}">

<meta property="og:title" content="OnBoard">
<meta property="og:type" content="Homepage">
<meta property="og:title" content="{{ site_title }}">
<meta property="og:type" content="{{ site_title }}">
<meta property="og:url" content="">
<meta property="og:image" content="">
<meta property="og:image:alt" content="Homepage">
<meta property="og:image:alt" content="{{ site_title }}">

<script defer src="https://unpkg.com/[email protected]/dist/htmx.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
Expand Down

0 comments on commit ecf65e9

Please sign in to comment.