fix: 修复聊天环境变量替换不完全 (close #542)

This commit is contained in:
CalciumIon 2024-11-05 16:02:10 +08:00
parent fe0ed128c6
commit 3e2ae29ba0
2 changed files with 4 additions and 4 deletions

View File

@ -393,8 +393,8 @@ const TokensTable = () => {
serverAddress = window.location.origin; serverAddress = window.location.origin;
} }
let encodedServerAddress = encodeURIComponent(serverAddress); let encodedServerAddress = encodeURIComponent(serverAddress);
url = url.replace('{address}', encodedServerAddress); url = url.replaceAll('{address}', encodedServerAddress);
url = url.replace('{key}', 'sk-' + record.key); url = url.replaceAll('{key}', 'sk-' + record.key);
// console.log(url); // console.log(url);
// const chatLink = localStorage.getItem('chat_link'); // const chatLink = localStorage.getItem('chat_link');
// const mjLink = localStorage.getItem('chat_link2'); // const mjLink = localStorage.getItem('chat_link2');

View File

@ -20,8 +20,8 @@ const ChatPage = () => {
if (Array.isArray(chats) && chats.length > 0) { if (Array.isArray(chats) && chats.length > 0) {
for (let k in chats[id]) { for (let k in chats[id]) {
link = chats[id][k]; link = chats[id][k];
link = link.replace('{address}', encodeURIComponent(serverAddress)); link = link.replaceAll('{address}', encodeURIComponent(serverAddress));
link = link.replace('{key}', 'sk-' + key); link = link.replaceAll('{key}', 'sk-' + key);
} }
} }
} }