mirror of
https://github.com/songquanpeng/one-api.git
synced 2026-02-28 16:54:26 +08:00
Compare commits
1 Commits
1f688d3254
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8df4a2670b |
@@ -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,12 +8,11 @@ import {
|
|||||||
IconKey,
|
IconKey,
|
||||||
IconGardenCart,
|
IconGardenCart,
|
||||||
IconUser,
|
IconUser,
|
||||||
IconUserScan,
|
IconUserScan
|
||||||
IconMessageCircle
|
|
||||||
} from '@tabler/icons-react';
|
} from '@tabler/icons-react';
|
||||||
|
|
||||||
// constant
|
// constant
|
||||||
const icons = { IconDashboard, IconSitemap, IconArticle, IconCoin, IconAdjustments, IconKey, IconGardenCart, IconUser, IconUserScan,IconMessageCircle };
|
const icons = { IconDashboard, IconSitemap, IconArticle, IconCoin, IconAdjustments, IconKey, IconGardenCart, IconUser, IconUserScan };
|
||||||
|
|
||||||
// ==============================|| DASHBOARD MENU ITEMS ||============================== //
|
// ==============================|| DASHBOARD MENU ITEMS ||============================== //
|
||||||
|
|
||||||
@@ -30,15 +29,6 @@ const panel = {
|
|||||||
breadcrumbs: false,
|
breadcrumbs: false,
|
||||||
isAdmin: false
|
isAdmin: false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'chat',
|
|
||||||
title: '聊天',
|
|
||||||
type: 'item',
|
|
||||||
url: '/panel/chat',
|
|
||||||
icon: icons.IconMessageCircle,
|
|
||||||
breadcrumbs: false,
|
|
||||||
isAdmin: false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'channel',
|
id: 'channel',
|
||||||
title: '渠道',
|
title: '渠道',
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { lazy } from 'react';
|
|||||||
// project imports
|
// project imports
|
||||||
import MainLayout from 'layout/MainLayout';
|
import MainLayout from 'layout/MainLayout';
|
||||||
import Loadable from 'ui-component/Loadable';
|
import Loadable from 'ui-component/Loadable';
|
||||||
import Chat from "../views/Chat";
|
|
||||||
|
|
||||||
const Channel = Loadable(lazy(() => import('views/Channel')));
|
const Channel = Loadable(lazy(() => import('views/Channel')));
|
||||||
const Log = Loadable(lazy(() => import('views/Log')));
|
const Log = Loadable(lazy(() => import('views/Log')));
|
||||||
@@ -32,10 +31,6 @@ const MainRoutes = {
|
|||||||
path: 'dashboard',
|
path: 'dashboard',
|
||||||
element: <Dashboard />
|
element: <Dashboard />
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: 'chat',
|
|
||||||
element: <Chat />
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: 'channel',
|
path: 'channel',
|
||||||
element: <Channel />
|
element: <Channel />
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
.MuiContainer-root {
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 0;
|
|
||||||
height: calc(100% - 1px);
|
|
||||||
max-width: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
.css-1xnbu7n-MuiContainer-root {
|
|
||||||
/* 如果有特定样式,请在此处添加 */
|
|
||||||
}
|
|
||||||
|
|
||||||
.css-9d4wr9 {
|
|
||||||
background-color: #eef2f6;
|
|
||||||
width: 100%;
|
|
||||||
min-height: calc(100vh - 88px);
|
|
||||||
flex-grow: 1;
|
|
||||||
padding: 0;
|
|
||||||
margin-top: 83.746px;
|
|
||||||
margin-right: 0;
|
|
||||||
border-radius: 12px;
|
|
||||||
border-bottom-left-radius: 0;
|
|
||||||
border-bottom-right-radius: 0;
|
|
||||||
transition: margin 225ms cubic-bezier(0.0, 0, 0.2, 1) 0ms;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-container {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
|
||||||
import { API } from "../../utils/api";
|
|
||||||
import "./index.css";
|
|
||||||
|
|
||||||
const useIsSmallScreen = () => {
|
|
||||||
const [isSmallScreen, setIsSmallScreen] = useState(window.innerWidth <= 768);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const handleResize = () => {
|
|
||||||
setIsSmallScreen(window.innerWidth <= 768);
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener('resize', handleResize);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
window.removeEventListener('resize', handleResize);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return isSmallScreen;
|
|
||||||
};
|
|
||||||
|
|
||||||
const Chat = () => {
|
|
||||||
const [chatUrl, setChatUrl] = useState("");
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
// const isSmallScreen = useIsSmallScreen();
|
|
||||||
|
|
||||||
const loadTokens = async () => {
|
|
||||||
try {
|
|
||||||
const res = await API.get(`/api/token/`);
|
|
||||||
const siteInfo = JSON.parse(localStorage.getItem('siteInfo'));
|
|
||||||
if (!siteInfo) {
|
|
||||||
console.error("siteInfo not found in localStorage");
|
|
||||||
setLoading(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// const url = `https://like.chatapi.asia/#/?settings={"key":"sk-xxx","url":"https://chat.chatapi.asia"}`;
|
|
||||||
const serverAddress = siteInfo.server_address;
|
|
||||||
const key = res.data.data[0].key;
|
|
||||||
const url = `${siteInfo.chat_link}/#/?settings={"key":"sk-${key}","url":"${serverAddress}"}`;
|
|
||||||
|
|
||||||
setChatUrl(url);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error loading tokens:", error);
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
loadTokens();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return <div className="chat-container">Loading...</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="chat-container">
|
|
||||||
<iframe
|
|
||||||
src={chatUrl}
|
|
||||||
style={{ height: '100%', width: '100%', padding: 0, border: 'none' }}
|
|
||||||
title="Chat"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Chat;
|
|
||||||
Reference in New Issue
Block a user