diff --git a/note_chat.py b/note_chat.py index ecc40c5..679a5c2 100644 --- a/note_chat.py +++ b/note_chat.py @@ -1,24 +1,21 @@ -from dotenv import load_dotenv -import os, time +import time import json from openai import OpenAI import chat_tools - -load_dotenv() +from bot_util import get_api_details # initialize parameters -DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY") -DEEPSEEK_API_URL = os.getenv("DEEPSEEK_API_URL") MODEL = "deepseek-chat" chat_tools = chat_tools.get_chat_tools() history = [] # Initialize the OpenAI client with the API key and base URL client = OpenAI( - api_key=DEEPSEEK_API_KEY, - base_url=DEEPSEEK_API_URL, + api_key=get_api_details().api_key, + base_url=get_api_details().api_url, ) + MAX_RETRIES = 3 RETRY_DELAY = 2 # seconds count = 0 @@ -52,7 +49,6 @@ def chat_with_deepseek(max_retries: int =MAX_RETRIES, retry_delay: int =RETRY_DE tool_name = tool_call.function.name tool_args = tool_call.function.arguments tool_id = tool_call.id - # Call the function with the arguments if tool_name == "write_file": params = json.loads(tool_args)