mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-18 02:16:07 +00:00
feat: 运行时原动态引入config的地方现在均使用初始化时导入的config对象
This commit is contained in:
@@ -2,8 +2,6 @@ import logging
|
||||
|
||||
import openai
|
||||
|
||||
import config
|
||||
|
||||
import pkg.openai.keymgr
|
||||
import pkg.openai.pricing as pricing
|
||||
import pkg.utils.context
|
||||
@@ -34,6 +32,7 @@ class OpenAIInteract:
|
||||
|
||||
# 请求OpenAI Completion
|
||||
def request_completion(self, prompt, stop):
|
||||
config = pkg.utils.context.get_config()
|
||||
response = openai.Completion.create(
|
||||
prompt=prompt,
|
||||
stop=stop,
|
||||
@@ -53,6 +52,7 @@ class OpenAIInteract:
|
||||
|
||||
def request_image(self, prompt):
|
||||
|
||||
config = pkg.utils.context.get_config()
|
||||
params = config.image_api_params if hasattr(config, "image_api_params") else self.default_image_api_params
|
||||
|
||||
response = openai.Image.create(
|
||||
|
||||
Reference in New Issue
Block a user