Skip to content

Commit e23da26

Browse files
committed
fix(main): load args if no config file
1 parent 8e32ba0 commit e23da26

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
from fastapi import FastAPI, Query
22
from fastapi.responses import PlainTextResponse
33
import uvicorn
4-
from prompt import Prompt
4+
55
from config import Config, parse_args
66
from openai_client import LLMClient
77
from db import DB
88

99

1010
proxy_server = FastAPI()
1111
args = parse_args()
12-
if args.config_file:
13-
config = Config.from_toml("config.toml")
12+
if args.config:
13+
config = Config.from_toml(args.config)
14+
else:
15+
config = Config.from_args(args)
1416
client = LLMClient.from_config(config)
1517
db = DB.from_file(config.database_config.db_file)
1618

openai_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def request_completion(self):
5151
str: The content of the response message from the language model.
5252
Exception: An exception if an error occurs during the API call.
5353
"""
54+
5455
try:
5556
completion = self.client.chat.completions.create(
5657
model=self.config.openai_config.model_name,

0 commit comments

Comments
 (0)