This commit is contained in:
shaoyongjun 2024-04-30 20:48:27 +08:00
parent a903c7114c
commit 3183e451b1

View File

@ -62,8 +62,8 @@
<script> <script>
// --------------------init-------------------------------------- // --------------------init--------------------------------------
const API_KEY = "你的key"; const API_KEY = "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";
const ENDPOINT = "https://api.openai.com/v1/chat/completions"; const ENDPOINT = "https://openrouter.ai/api/v1/chat/completions";
// 获取输入框元素 // 获取输入框元素
const userInput = document.getElementById('user-input'); const userInput = document.getElementById('user-input');
@ -108,7 +108,7 @@
const htmlSpanElement = displayChatGPTMessageAndGetContainer(); const htmlSpanElement = displayChatGPTMessageAndGetContainer();
// 发送消息到ChatGPT // 发送消息到ChatGPT
addMessage("user", message); addMessage("user", message);
const body = JSON.stringify({model: "gpt-3.5-turbo", messages: messages, stream: true}); const body = JSON.stringify({model: "mistralai/mistral-7b-instruct:free", messages: messages, stream: true});
ssePost( ssePost(
// 请求地址 // 请求地址
ENDPOINT, ENDPOINT,