[feat] Add support for chat stickers (#178)
# PR Checklist - [x] Did you check if it works normally in all models? *ignore this when it dosen't uses models* - [x] 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? - [x] Did you added a type def? # Description - This commit adds support for chat stickers by allowing users to use stickers in chat message window. - The users can toggle show additional asset list using a button. - Added Additional assets file extension data. - Added option for additional assets preview. - Optimized render when use streaming api. (prevent markdown again when message not changed) Added controls to Video/Audio Assets [Video11.webm](https://github.com/kwaroran/RisuAI/assets/11344967/8980282f-d001-4afc-a6d9-6f6369b4cd4c) [Video12.webm](https://github.com/kwaroran/RisuAI/assets/11344967/e0e153b8-eba6-48a5-b47d-d2dd287f32fd)
This commit is contained in:
@@ -342,7 +342,7 @@ export interface character{
|
||||
VOLUME_SCALE?: number
|
||||
}
|
||||
supaMemory?:boolean
|
||||
additionalAssets?:[string, string][]
|
||||
additionalAssets?:[string, string, string][]
|
||||
ttsReadOnlyQuoted?:boolean
|
||||
replaceGlobalNote:string
|
||||
backgroundHTML?:string
|
||||
@@ -525,7 +525,9 @@ export interface Database{
|
||||
expires_in?: number
|
||||
}
|
||||
},
|
||||
classicMaxWidth: boolean
|
||||
classicMaxWidth: boolean,
|
||||
useChatSticker:boolean,
|
||||
useAdditionalAssetsPreview:boolean,
|
||||
}
|
||||
|
||||
interface hordeConfig{
|
||||
@@ -564,6 +566,7 @@ export interface Chat{
|
||||
supaMemoryData?:string
|
||||
lastMemory?:string
|
||||
suggestMessages?:string[]
|
||||
isStreaming?:boolean
|
||||
}
|
||||
|
||||
export interface Message{
|
||||
|
||||
@@ -170,7 +170,7 @@ export async function readImage(data:string) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveAsset(data:Uint8Array, customId:string = ''){
|
||||
export async function saveAsset(data:Uint8Array, customId:string = '', fileName:string = ''){
|
||||
let id = ''
|
||||
if(customId !== ''){
|
||||
id = customId
|
||||
@@ -182,13 +182,17 @@ export async function saveAsset(data:Uint8Array, customId:string = ''){
|
||||
id = uuidv4()
|
||||
}
|
||||
}
|
||||
let fileExtension:string = 'png'
|
||||
if(fileName && fileName.split('.').length > 0){
|
||||
fileExtension = fileName.split('.').pop()
|
||||
}
|
||||
if(isTauri){
|
||||
await writeBinaryFile(`assets/${id}.png`, data ,{dir: BaseDirectory.AppData})
|
||||
return `assets/${id}.png`
|
||||
await writeBinaryFile(`assets/${id}.${fileExtension}`, data ,{dir: BaseDirectory.AppData})
|
||||
return `assets/${id}.${fileExtension}`
|
||||
}
|
||||
else{
|
||||
await forageStorage.setItem(`assets/${id}.png`, data)
|
||||
return `assets/${id}.png`
|
||||
await forageStorage.setItem(`assets/${id}.${fileExtension}`, data)
|
||||
return `assets/${id}.${fileExtension}`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user