@@ -20,12 +20,12 @@ For commercial licensing, please contact support@quantumnous.com
2020import React from 'react' ;
2121import {
2222 Avatar ,
23- Button ,
2423 Space ,
2524 Tag ,
2625 Tooltip ,
2726 Popover ,
2827 Typography ,
28+ Button
2929} from '@douyinfe/semi-ui' ;
3030import {
3131 timestamp2string ,
@@ -41,8 +41,8 @@ import {
4141 renderClaudeModelPrice ,
4242 renderModelPrice ,
4343} from '../../../helpers' ;
44- import { IconHelpCircle , IconStarStroked } from '@douyinfe/semi-icons' ;
45- import { Route } from 'lucide-react' ;
44+ import { IconHelpCircle } from '@douyinfe/semi-icons' ;
45+ import { Route , Sparkles } from 'lucide-react' ;
4646
4747const colors = [
4848 'amber' ,
@@ -307,28 +307,81 @@ export const getLogsColumns = ({
307307 render : ( text , record , index ) => {
308308 let isMultiKey = false ;
309309 let multiKeyIndex = - 1 ;
310+ let content = t ( '渠道' ) + `:${ record . channel } ` ;
311+ let affinity = null ;
312+ let showMarker = false ;
310313 let other = getLogOther ( record . other ) ;
311314 if ( other ?. admin_info ) {
312315 let adminInfo = other . admin_info ;
313316 if ( adminInfo ?. is_multi_key ) {
314317 isMultiKey = true ;
315318 multiKeyIndex = adminInfo . multi_key_index ;
316319 }
320+ if (
321+ Array . isArray ( adminInfo . use_channel ) &&
322+ adminInfo . use_channel . length > 0
323+ ) {
324+ content = t ( '渠道' ) + `:${ adminInfo . use_channel . join ( '->' ) } ` ;
325+ }
326+ if ( adminInfo . channel_affinity ) {
327+ affinity = adminInfo . channel_affinity ;
328+ showMarker = true ;
329+ }
317330 }
318331
319332 return isAdminUser &&
320333 ( record . type === 0 || record . type === 2 || record . type === 5 ) ? (
321334 < Space >
322- < Tooltip content = { record . channel_name || t ( '未知渠道' ) } >
323- < span >
324- < Tag
325- color = { colors [ parseInt ( text ) % colors . length ] }
326- shape = 'circle'
335+ < span style = { { position : 'relative' , display : 'inline-block' } } >
336+ < Tooltip content = { record . channel_name || t ( '未知渠道' ) } >
337+ < span >
338+ < Tag
339+ color = { colors [ parseInt ( text ) % colors . length ] }
340+ shape = 'circle'
341+ >
342+ { text }
343+ </ Tag >
344+ </ span >
345+ </ Tooltip >
346+ { showMarker && (
347+ < Tooltip
348+ content = {
349+ < div style = { { lineHeight : 1.6 } } >
350+ < div > { content } </ div >
351+ { affinity ? (
352+ < div style = { { marginTop : 6 } } >
353+ { buildChannelAffinityTooltip ( affinity , t ) }
354+ </ div >
355+ ) : null }
356+ </ div >
357+ }
327358 >
328- { text }
329- </ Tag >
330- </ span >
331- </ Tooltip >
359+ < span
360+ style = { {
361+ position : 'absolute' ,
362+ right : - 4 ,
363+ top : - 4 ,
364+ lineHeight : 1 ,
365+ fontWeight : 600 ,
366+ color : '#f59e0b' ,
367+ cursor : 'pointer' ,
368+ userSelect : 'none' ,
369+ } }
370+ onClick = { ( e ) => {
371+ e . stopPropagation ( ) ;
372+ openChannelAffinityUsageCacheModal ?. ( affinity ) ;
373+ } }
374+ >
375+ < Sparkles
376+ size = { 14 }
377+ strokeWidth = { 2 }
378+ color = 'currentColor'
379+ fill = 'currentColor'
380+ />
381+ </ span >
382+ </ Tooltip >
383+ ) }
384+ </ span >
332385 { isMultiKey && (
333386 < Tag color = 'white' shape = 'circle' >
334387 { multiKeyIndex }
@@ -559,68 +612,24 @@ export const getLogsColumns = ({
559612 return < > </ > ;
560613 }
561614 let content = t ( '渠道' ) + `:${ record . channel } ` ;
562- let affinity = null ;
563615 if ( record . other !== '' ) {
564616 let other = JSON . parse ( record . other ) ;
565617 if ( other === null ) {
566618 return < > </ > ;
567619 }
568620 if ( other . admin_info !== undefined ) {
569621 if (
570- other . admin_info . use_channel !== null &&
571- other . admin_info . use_channel !== undefined &&
572- other . admin_info . use_channel !== ''
622+ other . admin_info . use_channel !== null &&
623+ other . admin_info . use_channel !== undefined &&
624+ other . admin_info . use_channel !== ''
573625 ) {
574626 let useChannel = other . admin_info . use_channel ;
575627 let useChannelStr = useChannel . join ( '->' ) ;
576628 content = t ( '渠道' ) + `:${ useChannelStr } ` ;
577629 }
578- if ( other . admin_info . channel_affinity ) {
579- affinity = other . admin_info . channel_affinity ;
580- }
581630 }
582631 }
583- return isAdminUser ? (
584- < Space >
585- < div > { content } </ div >
586- { affinity ? (
587- < Tooltip
588- content = {
589- < div >
590- { buildChannelAffinityTooltip ( affinity , t ) }
591- < div style = { { marginTop : 6 } } >
592- < Button
593- theme = 'borderless'
594- size = 'small'
595- onClick = { ( e ) => {
596- e . stopPropagation ( ) ;
597- openChannelAffinityUsageCacheModal ?. ( affinity ) ;
598- } }
599- >
600- { t ( '查看详情' ) }
601- </ Button >
602- </ div >
603- </ div >
604- }
605- >
606- < span >
607- < Tag
608- className = 'channel-affinity-tag'
609- color = 'cyan'
610- shape = 'circle'
611- >
612- < span className = 'channel-affinity-tag-content' >
613- < IconStarStroked style = { { fontSize : 13 } } />
614- { t ( '优选' ) }
615- </ span >
616- </ Tag >
617- </ span >
618- </ Tooltip >
619- ) : null }
620- </ Space >
621- ) : (
622- < > </ >
623- ) ;
632+ return isAdminUser ? < div > { content } </ div > : < > </ > ;
624633 } ,
625634 } ,
626635 {
0 commit comments