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 1
1
import { useMemo , useState } from 'react' ;
2
2
import { useAppContext } from '../utils/app.context' ;
3
3
import { Message , PendingMessage } from '../utils/types' ;
4
- import { classNames } from '../utils/misc' ;
4
+ import { classNames , modelNameFromPath } from '../utils/misc' ;
5
5
import MarkdownDisplay , { CopyButton } from './MarkdownDisplay' ;
6
6
import {
7
7
ArrowPathIcon ,
@@ -201,7 +201,7 @@ export default function ChatMessage({
201
201
className = "cursor-pointer font-semibold text-sm opacity-60"
202
202
>
203
203
Model:{ ' ' }
204
- { msg . serverProps . model_path ?. split ( / ( \\ | \/ ) / ) . pop ( ) }
204
+ { msg . serverProps . model_path && modelNameFromPath ( msg . serverProps . model_path ) }
205
205
</ div >
206
206
< div className = "dropdown-content bg-base-100 z-10 w-80 p-2 shadow mt-4" >
207
207
< b > Server Information</ b >
Original file line number Diff line number Diff line change @@ -195,3 +195,10 @@ export const getServerProps = async (
195
195
throw error ;
196
196
}
197
197
} ;
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