mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-10 05:39:11 +00:00
Fix migration script error when openai not available (#530)
This commit is contained in:
@@ -99,9 +99,18 @@ def migrate_server_pg(args):
|
||||
model_type=ChatModelOptions.ModelType.OFFLINE,
|
||||
)
|
||||
|
||||
if "openai" in raw_config["processor"]["conversation"]:
|
||||
if (
|
||||
"openai" in raw_config["processor"]["conversation"]
|
||||
and raw_config["processor"]["conversation"]["openai"]
|
||||
):
|
||||
openai = raw_config["processor"]["conversation"]["openai"]
|
||||
|
||||
if openai.get("api-key") is None:
|
||||
logger.error("OpenAI API Key is not set. Will not be migrating OpenAI config.")
|
||||
else:
|
||||
if openai.get("chat-model") is None:
|
||||
openai["chat-model"] = "gpt-3.5-turbo"
|
||||
|
||||
OpenAIProcessorConversationConfig.objects.create(
|
||||
api_key=openai.get("api-key"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user