Skip to content

Commit e527508

Browse files
authored
1.102.4 (#416)
# PR Checklist - [ ] Did you check if it works normally in all models? *ignore this when it dosen't uses models* - [ ] Did you check if it works normally in all of web, local and node hosted versions? if it dosen't, did you blocked it in those versions? - [ ] Did you added a type def? # Description
2 parents ffe08d1 + a79a00b commit e527508

File tree

5 files changed

+31
-13
lines changed

5 files changed

+31
-13
lines changed

src-tauri/tauri.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"package": {
1010
"productName": "RisuAI",
11-
"version": "1.102.3"
11+
"version": "1.102.4"
1212
},
1313
"tauri": {
1414
"allowlist": {

src/etc/o200k_base.json

+1
Large diffs are not rendered by default.

src/ts/storage/database.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { OobaChatCompletionRequestParams } from '../model/ooba';
1414

1515
export const DataBase = writable({} as any as Database)
1616
export const loadedStore = writable(false)
17-
export let appVer = "1.102.3"
17+
export let appVer = "1.102.4"
1818
export let webAppSubVer = ''
1919

2020
export function setDatabase(data:Database){

src/ts/tokenizer.ts

+27-10
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ export async function encode(data:string):Promise<(number[]|Uint32Array|Int32Arr
7070
return await tokenizeWebTokenizers(data, 'llama')
7171
}
7272
}
73+
if(db.aiModel.startsWith('gpt4o')){
74+
return await tikJS(data, 'o200k_base')
75+
}
7376

7477
return await tikJS(data)
7578
}
@@ -79,17 +82,31 @@ type tokenizerType = 'novellist'|'claude'|'novelai'|'llama'|'mistral'|'llama3'
7982
let tikParser:Tiktoken = null
8083
let tokenizersTokenizer:Tokenizer = null
8184
let tokenizersType:tokenizerType = null
85+
let lastTikModel = 'cl100k_base'
8286

83-
async function tikJS(text:string) {
84-
if(!tikParser){
85-
const {Tiktoken} = await import('@dqbd/tiktoken')
86-
const cl100k_base = await import("@dqbd/tiktoken/encoders/cl100k_base.json");
87-
88-
tikParser = new Tiktoken(
89-
cl100k_base.bpe_ranks,
90-
cl100k_base.special_tokens,
91-
cl100k_base.pat_str
92-
);
87+
async function tikJS(text:string, model='cl100k_base') {
88+
if(!tikParser || lastTikModel !== model){
89+
if(model === 'cl100k_base'){
90+
const {Tiktoken} = await import('@dqbd/tiktoken')
91+
const cl100k_base = await import("@dqbd/tiktoken/encoders/cl100k_base.json");
92+
lastTikModel = model
93+
94+
tikParser = new Tiktoken(
95+
cl100k_base.bpe_ranks,
96+
cl100k_base.special_tokens,
97+
cl100k_base.pat_str
98+
);
99+
}
100+
if(model === 'o200k_base'){
101+
const {Tiktoken} = await import('@dqbd/tiktoken')
102+
const o200k_base = await import("src/etc/o200k_base.json");
103+
lastTikModel = model
104+
tikParser = new Tiktoken(
105+
o200k_base.bpe_ranks,
106+
o200k_base.special_tokens,
107+
o200k_base.pat_str
108+
);
109+
}
93110
}
94111
return tikParser.encode(text)
95112
}

version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"1.102.3"}
1+
{"version":"1.102.4"}

0 commit comments

Comments
 (0)