优化代码,提高解耦
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
import os # 导入环境变量
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
api_key = os.getenv("OPENAI_API_KEY")
|
||||
|
||||
|
||||
from config import OPENAI_API_KEY
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(
|
||||
api_key=api_key,
|
||||
api_key=OPENAI_API_KEY,
|
||||
base_url="https://api.deepseek.com")
|
||||
|
||||
response = client.chat.completions.create(
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import os # 导入环境变量
|
||||
from dotenv import load_dotenv
|
||||
from config import OPENAI_API_KEY
|
||||
from openai import OpenAI
|
||||
|
||||
load_dotenv()
|
||||
|
||||
def create_client():
|
||||
api_key = os.getenv("OPENAI_API_KEY")
|
||||
return OpenAI(api_key=api_key,base_url="https://api.deepseek.com")
|
||||
return OpenAI(api_key=OPENAI_API_KEY,base_url="https://api.deepseek.com")
|
||||
|
||||
def chat_loop(agent_client):
|
||||
messages = [
|
||||
|
||||
Reference in New Issue
Block a user