File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import { FreeTagPicker } from "../fields/TagPicker";
2626import type { SpecV3 } from "@lenml/char-card-reader" ;
2727import { keysFix } from "../../tools/fixs" ;
2828import { CardFieldLabel } from "../HelpTips/CardFieldLabel" ;
29+ import { encodeToTokens } from "../../tools/tokenizer" ;
2930
3031export const BookEntryEditor : FC < {
3132 entry : SpecV3 . Lorebook [ "entries" ] [ number ] ;
@@ -69,9 +70,27 @@ export const BookEntryEditor: FC<{
6970 return (
7071 < Card className = { styles . bookEntryCard } >
7172 < div className = { styles . bookEntryHeader } >
72- < Text weight = "semibold" >
73- Entry { index + 1 } { entry_title ? `(${ entry_title } )` : "" }
74- </ Text >
73+ < span >
74+ < Text weight = "semibold" >
75+ Entry { index + 1 } { entry_title ? `(${ entry_title } )` : "" }
76+ </ Text >
77+
78+ { expanded ? null : (
79+ < Text
80+ style = { {
81+ fontSize : "12px" ,
82+ marginLeft : "1rem" ,
83+ display : "inline-block" ,
84+ textAlign : "right" ,
85+ } }
86+ >
87+ { t ( "word_count" , {
88+ chars : entry . content . split ( "" ) . length ,
89+ tokens : encodeToTokens ( entry . content ) . length ,
90+ } ) }
91+ </ Text >
92+ ) }
93+ </ span >
7594 < div >
7695 { /* 收起展开 */ }
7796 < Tooltip
You can’t perform that action at this time.
0 commit comments