@@ -51,31 +55,51 @@
:closable="false"
show-icon
style="margin-bottom: 10px; font-size:14px;">
- 注意:如果是百度文心一言平台,需要用竖线(|)将 API Key 和 Secret Key 串接起来填入!
- 注意:如果是讯飞星火大模型,需要用竖线(|)将 APPID, APIKey 和 APISecret 按照顺序串接起来填入!
+ 注意:如果是百度文心一言平台,API-KEY 为 APIKey|SecretKey,中间用竖线(|)连接
+ 注意:如果是讯飞星火大模型,API-KEY 为 AppId|APIKey|APISecret,中间用竖线(|)连接
-
+
{{
item.name
}}
-
-
-
-
-
+
{{
item.name
}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -93,7 +117,7 @@ import {reactive, ref} from "vue";
import {httpGet, httpPost} from "@/utils/http";
import {ElMessage} from "element-plus";
import {dateFormat, disabledDate, removeArrayItem} from "@/utils/libs";
-import {Plus} from "@element-plus/icons-vue";
+import {InfoFilled, Plus} from "@element-plus/icons-vue";
// 变量定义
const items = ref([])
@@ -108,11 +132,32 @@ const loading = ref(true)
const formRef = ref(null)
const title = ref("")
const platforms = ref([
- {name: "【OpenAI】ChatGPT", value: "OpenAI"},
- {name: "【讯飞】星火大模型", value: "XunFei"},
- {name: "【清华智普】ChatGLM", value: "ChatGLM"},
- {name: "【百度】文心一言", value: "Baidu"},
- {name: "【微软】Azure", value: "Azure"},
+ {
+ name: "【OpenAI】ChatGPT",
+ value: "OpenAI",
+ api_url: "https://api.fast-tunnel.one/v1/chat/completions",
+ img_url: "https://api.openai.com/v1/images/generations"
+ },
+ {
+ name: "【讯飞】星火大模型",
+ value: "XunFei",
+ api_url: "wss://spark-api.xf-yun.com/{version}/chat"
+ },
+ {
+ name: "【清华智普】ChatGLM",
+ value: "ChatGLM",
+ api_url: "https://open.bigmodel.cn/api/paas/v3/model-api/{model}/sse-invoke"
+ },
+ {
+ name: "【百度】文心一言",
+ value: "Baidu",
+ api_url: "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/{model}"
+ },
+ {
+ name: "【微软】Azure",
+ value: "Azure",
+ api_url: "https://chat-bot-api.openai.azure.com/openai/deployments/{model}/chat/completions?api-version=2023-05-15"
+ },
])
const types = ref([
{name: "聊天", value: "chat"},
@@ -176,6 +221,33 @@ const remove = function (row) {
ElMessage.error("删除失败:" + e.message)
})
}
+
+const set = (filed, row) => {
+ httpPost('/api/admin/apikey/set', {id: row.id, filed: filed, value: row[filed]}).then(() => {
+ ElMessage.success("操作成功!")
+ }).catch(e => {
+ ElMessage.error("操作失败:" + e.message)
+ })
+}
+
+const changePlatform = () => {
+ let platform = null
+ for (let v of platforms.value) {
+ if (v.value === item.value.platform) {
+ platform = v
+ break
+ }
+ }
+ if (platform !== null) {
+ if (item.value.type === "chat") {
+ item.value.api_url = platform.api_url
+ } else if (platform.img_url) {
+ item.value.api_url = platform.img_url
+ }
+
+ }
+}
+
\ No newline at end of file