File tree 2 files changed +11
-9
lines changed
2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ ChatLuna 核心相关库。
15
15
16
16
ChatLuna 对话存储相关库,提供相关 API。基于 [ minato] ( https://github.com/cordiverse/minato ) 实现与数据库的交互。
17
17
18
+ - [ @chatluna/utils ] ( ./packages/utils/README.MD )
19
+
20
+ ChatLuna 辅助库,提供一些简单的 API 如 SSE 解析,等待锁等。
21
+
18
22
- [ @chatluna/koishi ] ( ./packages/koishi/README.MD )
19
23
20
24
ChatLuna 运行在 Koishi 上的核心支持库。
Original file line number Diff line number Diff line change
1
+ import { Request } from '@chatluna/core/service'
2
+ import {
3
+ ChatLunaError ,
4
+ ChatLunaErrorCode ,
5
+ withResolver
6
+ } from '@chatluna/core/utils'
1
7
import { Context } from '@cordisjs/core'
2
8
import {
3
9
getEncodingNameForModel ,
@@ -6,13 +12,7 @@ import {
6
12
TiktokenEncoding ,
7
13
TiktokenModel
8
14
} from 'js-tiktoken/lite'
9
- import { Request } from '@chatluna/core/service'
10
15
import { fetch } from 'undici'
11
- import {
12
- ChatLunaError ,
13
- ChatLunaErrorCode ,
14
- withResolver
15
- } from '@chatluna/core/utils'
16
16
17
17
globalThis . chatluna_tiktoken_cache = globalThis . chatluna_tiktoken_cache ?? { }
18
18
@@ -50,12 +50,10 @@ export async function getEncoding(
50
50
throw e
51
51
} )
52
52
53
- const tiktoken = new Tiktoken (
53
+ cache [ encoding ] = new Tiktoken (
54
54
tiktokenBPE ,
55
55
options ?. extendedSpecialTokens
56
56
)
57
-
58
- cache [ encoding ] = tiktoken
59
57
}
60
58
61
59
return cache [ encoding ]
You can’t perform that action at this time.
0 commit comments