kopia lustrzana https://github.com/hc-psy/blender-gpt
Update code to openai 1.0 api
rodzic
5db883be5c
commit
cde981285a
|
@ -116,7 +116,10 @@ def chatgpt(context):
|
|||
messages.append({"role": "user", "content": "Please provide me with Blender (3D software) python code satisfying the following task: " +
|
||||
prompts[lan] + ". \n. Do not provide with anything that is not Python code. Do not provide explanations and comments."})
|
||||
|
||||
response = openai.ChatCompletion.create(
|
||||
client = openai.OpenAI(
|
||||
api_key = context.preferences.addons["blender-gpt"].preferences.openai_key,
|
||||
)
|
||||
response = client.chat.completions.create(
|
||||
model=models[lan],
|
||||
messages=messages,
|
||||
temperature=temperatures[lan],
|
||||
|
|
|
@ -95,9 +95,9 @@ class BLENDERGPT_OT_SEND_MSG(Operator):
|
|||
|
||||
# TODO: connect to GPT
|
||||
prf = context.preferences
|
||||
openai.api_key = prf.addons["blender-gpt"].preferences.openai_key
|
||||
openai_api_key = prf.addons["blender-gpt"].preferences.openai_key
|
||||
|
||||
if not openai.api_key:
|
||||
if not openai_api_key:
|
||||
if int(context.scene.lan) == 0:
|
||||
self.report(
|
||||
{'ERROR'}, "錯誤: 沒有偵測到 OPENAI API Key,請在插件設定中設定 OPENAI API Key")
|
||||
|
|
Ładowanie…
Reference in New Issue