🔄Update: 删除加密逻辑
This commit is contained in:
@@ -50,7 +50,6 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { decrypt } from '../utils/encryption'
|
||||
|
||||
// 响应式数据
|
||||
const userInput = ref('')
|
||||
@@ -143,7 +142,13 @@ const sendMessage = async () => {
|
||||
const callAIPlatform = async (platformId, apiKey, endpoint, message) => {
|
||||
try {
|
||||
// 发送请求到后端API
|
||||
const response = await fetch('/api/chat', {
|
||||
// console.log(JSON.stringify({
|
||||
// platformId,
|
||||
// apiKey,
|
||||
// endpoint,
|
||||
// message
|
||||
// }))
|
||||
const response = await fetch('http://localhost:8080/api/chat', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -154,7 +159,8 @@ const callAIPlatform = async (platformId, apiKey, endpoint, message) => {
|
||||
endpoint,
|
||||
message
|
||||
})
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`)
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { encrypt } from '../utils/encryption'
|
||||
|
||||
// 厂商配置预设
|
||||
const platforms = [
|
||||
@@ -151,13 +150,10 @@ const saveConfig = () => {
|
||||
return
|
||||
}
|
||||
|
||||
// 加密密钥
|
||||
const encryptedKey = encrypt(apiKey.value)
|
||||
|
||||
// 构造配置对象
|
||||
const config = {
|
||||
id: selectedPlatform.value,
|
||||
apiKey: encryptedKey,
|
||||
apiKey: apiKey.value,
|
||||
endpoint: endpoint.value
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user