mirror of
https://github.com/songquanpeng/one-api.git
synced 2026-04-28 04:24:26 +08:00
Compare commits
4 Commits
v0.6.11-al
...
30e9f8d4c2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30e9f8d4c2 | ||
|
|
8df4a2670b | ||
|
|
ed502e0b7f | ||
|
|
4688917db7 |
@@ -72,7 +72,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
|
|||||||
+ [x] [Anthropic Claude 系列模型](https://anthropic.com) (支持 AWS Claude)
|
+ [x] [Anthropic Claude 系列模型](https://anthropic.com) (支持 AWS Claude)
|
||||||
+ [x] [Google PaLM2/Gemini 系列模型](https://developers.generativeai.google)
|
+ [x] [Google PaLM2/Gemini 系列模型](https://developers.generativeai.google)
|
||||||
+ [x] [Mistral 系列模型](https://mistral.ai/)
|
+ [x] [Mistral 系列模型](https://mistral.ai/)
|
||||||
+ [x] [字节跳动豆包大模型](https://console.volcengine.com/ark/region:ark+cn-beijing/model)
|
+ [x] [字节跳动豆包大模型(火山引擎)](https://www.volcengine.com/experience/ark?utm_term=202502dsinvite&ac=DSASUQY5&rc=2QXCA1VI)
|
||||||
+ [x] [百度文心一言系列模型](https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html)
|
+ [x] [百度文心一言系列模型](https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html)
|
||||||
+ [x] [阿里通义千问系列模型](https://help.aliyun.com/document_detail/2400395.html)
|
+ [x] [阿里通义千问系列模型](https://help.aliyun.com/document_detail/2400395.html)
|
||||||
+ [x] [讯飞星火认知大模型](https://www.xfyun.cn/doc/spark/Web.html)
|
+ [x] [讯飞星火认知大模型](https://www.xfyun.cn/doc/spark/Web.html)
|
||||||
|
|||||||
@@ -8,11 +8,12 @@ import {
|
|||||||
IconKey,
|
IconKey,
|
||||||
IconGardenCart,
|
IconGardenCart,
|
||||||
IconUser,
|
IconUser,
|
||||||
IconUserScan
|
IconUserScan,
|
||||||
|
IconFileTextAi
|
||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
|
|
||||||
// constant
|
// constant
|
||||||
const icons = { IconDashboard, IconSitemap, IconArticle, IconCoin, IconAdjustments, IconKey, IconGardenCart, IconUser, IconUserScan };
|
const icons = { IconDashboard, IconSitemap, IconArticle, IconCoin, IconAdjustments, IconKey, IconGardenCart, IconUser, IconUserScan,IconFileTextAi };
|
||||||
|
|
||||||
// ==============================|| DASHBOARD MENU ITEMS ||============================== //
|
// ==============================|| DASHBOARD MENU ITEMS ||============================== //
|
||||||
|
|
||||||
@@ -29,6 +30,14 @@ const panel = {
|
|||||||
breadcrumbs: false,
|
breadcrumbs: false,
|
||||||
isAdmin: false
|
isAdmin: false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'chat',
|
||||||
|
title: '聊天',
|
||||||
|
type: 'item',
|
||||||
|
url: '/panel/chat',
|
||||||
|
icon: icons.IconFileTextAi,
|
||||||
|
breadcrumbs: false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'channel',
|
id: 'channel',
|
||||||
title: '渠道',
|
title: '渠道',
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const Log = Loadable(lazy(() => import('views/Log')));
|
|||||||
const Redemption = Loadable(lazy(() => import('views/Redemption')));
|
const Redemption = Loadable(lazy(() => import('views/Redemption')));
|
||||||
const Setting = Loadable(lazy(() => import('views/Setting')));
|
const Setting = Loadable(lazy(() => import('views/Setting')));
|
||||||
const Token = Loadable(lazy(() => import('views/Token')));
|
const Token = Loadable(lazy(() => import('views/Token')));
|
||||||
|
const Chat = Loadable(lazy(() => import('views/Chat')));
|
||||||
const Topup = Loadable(lazy(() => import('views/Topup')));
|
const Topup = Loadable(lazy(() => import('views/Topup')));
|
||||||
const User = Loadable(lazy(() => import('views/User')));
|
const User = Loadable(lazy(() => import('views/User')));
|
||||||
const Profile = Loadable(lazy(() => import('views/Profile')));
|
const Profile = Loadable(lazy(() => import('views/Profile')));
|
||||||
@@ -39,6 +40,10 @@ const MainRoutes = {
|
|||||||
path: 'log',
|
path: 'log',
|
||||||
element: <Log />
|
element: <Log />
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'chat',
|
||||||
|
element: <Chat />
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'redemption',
|
path: 'redemption',
|
||||||
element: <Redemption />
|
element: <Redemption />
|
||||||
|
|||||||
37
web/berry/src/views/Chat/index.js
Normal file
37
web/berry/src/views/Chat/index.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { API } from 'utils/api';
|
||||||
|
import { showError, showSuccess } from 'utils/common';
|
||||||
|
|
||||||
|
const Chat = () => {
|
||||||
|
const [value, setValue] = useState([]);
|
||||||
|
const [isLoading, setIsLoading] = useState(true); // 加载状态
|
||||||
|
|
||||||
|
const loadTokens = async () => {
|
||||||
|
setIsLoading(true); // 开始加载
|
||||||
|
const res = await API.get(`/api/token/?p=0`);
|
||||||
|
const { success, message, data } = res.data;
|
||||||
|
setValue(data);
|
||||||
|
setIsLoading(false); // 加载完成
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadTokens();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <div>Loading...</div>;
|
||||||
|
} else if (value.length) {
|
||||||
|
const siteInfo = JSON.parse(localStorage.getItem("siteInfo"));
|
||||||
|
const chatLink = siteInfo.chat_link + `#/?settings={"key":"sk-${value[0]?.key}","url":"${siteInfo.server_address}"}`;
|
||||||
|
return (
|
||||||
|
<iframe
|
||||||
|
src={chatLink}
|
||||||
|
style={{ width: "100%", height: "85vh", border: "none" }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
showError("未找到可用令牌,请先创建令牌");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Chat;
|
||||||
Reference in New Issue
Block a user