Skip to content

Commit 5167182

Browse files
committed
add: The channel icon to which the model belongs
1 parent a3ece57 commit 5167182

File tree

8 files changed

+14358
-8023
lines changed

8 files changed

+14358
-8023
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,12 @@ docker-compose ps
160160

161161

162162

163-
![日志界面](https://github.com/user-attachments/assets/ad248ec2-f8dc-4bfb-ae94-83331df00357)
163+
![日志界面](https://github.com/user-attachments/assets/f4ce6400-200a-47d5-97d6-4811700625d9)
164164

165+
![模型计费](https://github.com/user-attachments/assets/0389a065-00f3-41ac-9fb1-0c7eccd41d49)
165166

166167

167-
![渠道管理](https://github.com/ai365vip/chat-api/assets/154959065/0017e8cb-645b-4c05-aefa-6cd538989278)
168+
![渠道管理](https://github.com/user-attachments/assets/69a8511c-e976-45a1-b3ab-a33fbbdadbee)
168169

169170

170171

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.5.1
1+
v0.5.2

web-user/package-lock.json

+13,750-7,963
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web-user/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"@emotion/cache": "^11.11.0",
99
"@emotion/react": "^11.11.3",
1010
"@emotion/styled": "^11.11.0",
11+
"@lobehub/icons": "^1.80.0",
1112
"@mui/icons-material": "^5.15.7",
1213
"@mui/lab": "^5.0.0-alpha.163",
1314
"@mui/material": "^5.15.7",

web-user/src/utils/common.js

+70
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ export function getSystemName() {
88
if (!system_name) return 'Chat API';
99
return system_name;
1010
}
11+
import {
12+
OpenAI, Claude, Gemini, DeepSeek, Zhipu, Hunyuan,
13+
Spark, Minimax, Yi, Groq, Ollama,
14+
Doubao, Ai360, Midjourney, Flux, Grok, Suno,
15+
Pika, Vidu,BaiduCloud,AlibabaCloud,Cohere,Baichuan,Kimi
16+
} from '@lobehub/icons';
17+
1118

1219
export function isMobile() {
1320
return window.innerWidth <= 600;
@@ -288,3 +295,66 @@ export function removeTrailingSlash(url) {
288295
return url;
289296
}
290297
}
298+
299+
export const getModelIcon = (modelName) => {
300+
if (modelName.startsWith('gpt-3')) {
301+
return <OpenAI.Avatar size={20} type="gpt3" />;
302+
} else if (modelName.startsWith('gpt-4') || modelName.startsWith('chatgpt')) {
303+
return <OpenAI.Avatar size={20} type="gpt4" />;
304+
} else if (modelName.startsWith('o1') || modelName.startsWith('o3')) {
305+
return <OpenAI.Avatar size={20} type="o1" />;
306+
} else if (modelName.startsWith('tts') || modelName.startsWith('dall-e') ||
307+
modelName.startsWith('whisper') || modelName.startsWith('omni-') ||
308+
modelName.startsWith('text-embedding') || modelName.startsWith('text-moderation-')
309+
|| modelName.startsWith('davinci') || modelName.startsWith('babbage')
310+
) {
311+
return <OpenAI.Avatar size={20} />;
312+
}else if (modelName.startsWith('claude')) {
313+
return <Claude.Color size={20} />;
314+
} else if (modelName.startsWith('gemini')) {
315+
return <Gemini.Color size={20} />;
316+
} else if (modelName.startsWith('deepseek')) {
317+
return <DeepSeek.Color size={20} />;
318+
} else if (modelName.startsWith('glm') || modelName.startsWith('chatglm')) {
319+
return <Zhipu.Color size={20} />;
320+
} else if (modelName.startsWith('hunyuan')) {
321+
return <Hunyuan.Color size={20} />;
322+
} else if (modelName.startsWith('Spark')) {
323+
return <Spark.Color size={20} />;
324+
} else if (modelName.startsWith('abab')) {
325+
return <Minimax.Color size={20} />;
326+
} else if (modelName.startsWith('moonshot')) {
327+
return <Kimi.Color size={20} />;
328+
} else if (modelName.startsWith('yi')) {
329+
return <Yi.Color size={20} />;
330+
} else if (modelName.startsWith('groq')) {
331+
return <Groq size={20} />;
332+
} else if (modelName.startsWith('ollama') || modelName.startsWith('llama')) {
333+
return <Ollama size={20} />;
334+
} else if (modelName.startsWith('doubao')) {
335+
return <Doubao.Color size={20} />;
336+
} else if (modelName.startsWith('360')) {
337+
return <Ai360.Color size={20} />;
338+
} else if (modelName.startsWith('midjourney') || modelName.startsWith('mj-chat')) {
339+
return <Midjourney size={20} />;
340+
} else if (modelName.startsWith('flux')) {
341+
return <Flux size={20} />;
342+
} else if (modelName.startsWith('grok')) {
343+
return <Grok size={20} />;
344+
} else if (modelName.startsWith('suno')) {
345+
return <Suno size={20} />;
346+
} else if (modelName.startsWith('pika')) {
347+
return <Pika size={20} />;
348+
} else if (modelName.startsWith('vidu')) {
349+
return <Vidu.Color size={20} />;
350+
} else if (modelName.startsWith('ERNIE-')) {
351+
return <BaiduCloud.Color size={20} />;
352+
} else if (modelName.startsWith('qwen-')) {
353+
return <AlibabaCloud.Color size={20} />;
354+
} else if (modelName.startsWith('command')) {
355+
return <Cohere.Color size={20} />;
356+
} else if (modelName.startsWith('Baichuan')) {
357+
return <Baichuan.Color size={20} />;
358+
}
359+
return null;
360+
};

web-user/src/views/Log/component/TableRow.js

+24-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import PropTypes from 'prop-types';
22
import { TableRow, TableCell, Tooltip } from '@mui/material';
33
import { timestamp2string, renderQuota, showSuccess, showError } from 'utils/common';
44
import Label from 'ui-component/Label';
5+
import { InputOutlined, OutputOutlined, PaidOutlined } from '@mui/icons-material';
6+
7+
import { getModelIcon } from 'utils/common';
8+
59
import { blue, grey, orange, red, green } from '@mui/material/colors';
610
function renderIsStream(bool) {
711
return bool ? (
@@ -180,17 +184,33 @@ export default function LogTableRow({ item }) {
180184
<TableCell>{renderType(item.type)}</TableCell>
181185
<TableCell onClick={() => handleCopyToClipboard(item.model_name)}>
182186
<Label style={{ color: getModelColor(item.model_name) }} variant="outlined">
183-
{item.model_name}
187+
{getModelIcon(item.model_name)}
188+
<span style={{ marginLeft: '4px' }}>{item.model_name}</span>
184189
</Label>
185190
</TableCell>
186191
<TableCell>{item.ip}</TableCell>
187192
<TableCell>
188193
{renderUseTime(item.use_time)}
189194
{renderIsStream(item.is_stream)}
190195
</TableCell>
191-
<TableCell>{item.prompt_tokens || ''}</TableCell>
192-
<TableCell>{item.completion_tokens || ''}</TableCell>
193-
<TableCell>{item.quota ? renderQuota(item.quota, 6) : ''}</TableCell>
196+
<TableCell>
197+
<div style={{ display: 'flex', alignItems: 'center' }}>
198+
<InputOutlined fontSize="small" sx={{ color: '#2196F3', marginRight: '4px' }}/>
199+
{item.prompt_tokens || ''}
200+
</div>
201+
</TableCell>
202+
<TableCell>
203+
<div style={{ display: 'flex', alignItems: 'center' }}>
204+
<OutputOutlined fontSize="small" sx={{ color: '#4CAF50', marginRight: '4px' }}/>
205+
{item.completion_tokens || ''}
206+
</div>
207+
</TableCell>
208+
<TableCell>
209+
<div style={{ display: 'flex', alignItems: 'center' }}>
210+
<PaidOutlined fontSize="small" sx={{ color: '#FF9800', marginRight: '4px' }}/>
211+
{item.quota ? renderQuota(item.quota, 6) : ''}
212+
</div>
213+
</TableCell>
194214
<TableCell>
195215
{item.multiplier ? (
196216
<Tooltip title={

0 commit comments

Comments
 (0)