mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-01 22:04:51 +00:00
更新示例
This commit is contained in:
parent
e25bcca365
commit
93d38bafa4
3 changed files with 12 additions and 11 deletions
|
|
@ -2,13 +2,14 @@ import os
|
|||
import yaml
|
||||
import openai
|
||||
|
||||
# with open(os.getcwd() +'/src/ai_chat/config/openai.yaml', 'r', encoding='utf-8') as f:
|
||||
# chat = yaml.load(f.read(), Loader=yaml.FullLoader).get('openai')
|
||||
# base_url = chat.get('base_url')
|
||||
# api_key = chat.get('api_key')
|
||||
with open(os.getcwd() +'/src/ai_chat/config/openai.yaml', 'r', encoding='utf-8') as f:
|
||||
chat = yaml.load(f.read(), Loader=yaml.FullLoader).get('openai')
|
||||
base_url = chat.get('base_url')
|
||||
api_key = chat.get('api_key')
|
||||
|
||||
openai.base_url = base_url
|
||||
openai.api_key = api_key
|
||||
|
||||
openai.api_key = "sk-iFEJzlBCdcq3OCvIFaF6797865854f729eA0B3CcEb406bAb"
|
||||
openai.base_url = "https://free.v36.cm"
|
||||
openai.default_headers = {"x-foo": "true"}
|
||||
|
||||
setting = "接下来,你将进行模拟一个扮演动漫角色。你不再是一个语言模型," \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
openai:
|
||||
url: "<KEY>"
|
||||
key: "<KEY>"
|
||||
base_url: "<KEY>"
|
||||
api_key: "<KEY>"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ def QrFortune_init():
|
|||
"""
|
||||
def execute_init_file():
|
||||
# 拼接文件的完整路径
|
||||
file_path = os.getcwd() + "\\src\\my_sqlite\\data_init\\fortune_init_data.py"
|
||||
file_path = os.getcwd() + "/src/my_sqlite/data_init/fortune_init_data.py"
|
||||
init_file_path = os.path.join(os.path.dirname(__file__), file_path)
|
||||
try:
|
||||
# 执行初始化文件
|
||||
|
|
@ -53,7 +53,7 @@ def touch_init():
|
|||
"""
|
||||
def execute_init_file2():
|
||||
# 拼接文件的完整路径
|
||||
file_path = os.getcwd() + "\\src\\my_sqlite\\data_init\\touch_init_data.py"
|
||||
file_path = os.getcwd() + "/src/my_sqlite/data_init/touch_init_data.py"
|
||||
init_file_path = os.path.join(os.path.dirname(__file__), file_path)
|
||||
try:
|
||||
# 执行初始化文件
|
||||
|
|
@ -81,7 +81,7 @@ def todo_init():
|
|||
"""
|
||||
def execute_init_file3():
|
||||
# 拼接文件的完整路径
|
||||
file_path = os.getcwd() + "\\src\\my_sqlite\\data_init\\todo_init.py"
|
||||
file_path = os.getcwd() + "/src/my_sqlite/data_init/todo_init.py"
|
||||
init_file_path = os.path.join(os.path.dirname(__file__), file_path)
|
||||
try:
|
||||
# 执行初始化文件
|
||||
|
|
|
|||
Loading…
Reference in a new issue