File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 11import { useMemo , useState } from 'react' ;
22import { useAppContext } from '../utils/app.context' ;
33import { Message , PendingMessage } from '../utils/types' ;
4- import { classNames } from '../utils/misc' ;
4+ import { classNames , modelNameFromPath } from '../utils/misc' ;
55import MarkdownDisplay , { CopyButton } from './MarkdownDisplay' ;
66import {
77 ArrowPathIcon ,
@@ -201,7 +201,7 @@ export default function ChatMessage({
201201 className = "cursor-pointer font-semibold text-sm opacity-60"
202202 >
203203 Model:{ ' ' }
204- { msg . serverProps . model_path ?. split ( / ( \\ | \/ ) / ) . pop ( ) }
204+ { msg . serverProps . model_path && modelNameFromPath ( msg . serverProps . model_path ) }
205205 </ div >
206206 < div className = "dropdown-content bg-base-100 z-10 w-80 p-2 shadow mt-4" >
207207 < b > Server Information</ b >
Original file line number Diff line number Diff line change @@ -195,3 +195,10 @@ export const getServerProps = async (
195195 throw error ;
196196 }
197197} ;
198+
199+ export const modelNameFromPath = ( path : string ) : string => {
200+ // get the last non-empty part
201+ const trimmed = path . replace ( / [ \\ \/ ] + $ / , '' ) ;
202+ const parts = trimmed . split ( / [ \\ \/ ] / ) ;
203+ return parts [ parts . length - 1 ] || path ;
204+ } ;
You can’t perform that action at this time.
0 commit comments