[fix] name appending wrong
This commit is contained in:
17
src/etc/updateLog.ts
Normal file
17
src/etc/updateLog.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
export const patchNote = {
|
||||||
|
version: "1.68.0",
|
||||||
|
content:
|
||||||
|
`
|
||||||
|
- Added Post End
|
||||||
|
- Added Send Chat as System
|
||||||
|
- Added Utility Override
|
||||||
|
- Minor fixes
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPatchNote(version: string){
|
||||||
|
if(patchNote.version.split(".")[1] === version.split(".")[1] && patchNote.version.split(".")[0] === version.split(".")[0]){
|
||||||
|
return patchNote.content
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
@@ -469,7 +469,7 @@ export const languageEnglish = {
|
|||||||
assistantPrefill: "Assistant Prefill",
|
assistantPrefill: "Assistant Prefill",
|
||||||
postEndInnerFormat: "Post End",
|
postEndInnerFormat: "Post End",
|
||||||
sendChatAsSystem: "Send Chat as System",
|
sendChatAsSystem: "Send Chat as System",
|
||||||
sendName: "Send Name",
|
sendName: "Send Name on Non-group Chat",
|
||||||
utilOverride: "Utility Override",
|
utilOverride: "Utility Override",
|
||||||
template: "Template",
|
template: "Template",
|
||||||
|
|
||||||
|
|||||||
@@ -625,6 +625,7 @@ export async function getRisuHub(arg?:{
|
|||||||
page?:number,
|
page?:number,
|
||||||
nsfw?:boolean
|
nsfw?:boolean
|
||||||
sort?:string
|
sort?:string
|
||||||
|
updateData?:boolean
|
||||||
}):Promise<hubType[]> {
|
}):Promise<hubType[]> {
|
||||||
try {
|
try {
|
||||||
const da = await fetch(hubURL + '/hub/list', {
|
const da = await fetch(hubURL + '/hub/list', {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ export function polyfill() {
|
|||||||
testDom.remove()
|
testDom.remove()
|
||||||
|
|
||||||
if((!supports) || isIos){
|
if((!supports) || isIos){
|
||||||
console.log('polyfiled dragdrop')
|
|
||||||
globalThis.polyfilledDragDrop = true
|
globalThis.polyfilledDragDrop = true
|
||||||
dragPolyfill({
|
dragPolyfill({
|
||||||
// use this to make use of the scroll behaviour
|
// use this to make use of the scroll behaviour
|
||||||
@@ -20,9 +19,6 @@ export function polyfill() {
|
|||||||
forceApply: true
|
forceApply: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
console.log("supports dragdrop")
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export interface OpenAIChat{
|
|||||||
memo?:string
|
memo?:string
|
||||||
name?:string
|
name?:string
|
||||||
removable?:boolean
|
removable?:boolean
|
||||||
|
attr?:string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OpenAIChatFull extends OpenAIChat{
|
export interface OpenAIChatFull extends OpenAIChat{
|
||||||
@@ -566,11 +567,18 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let attr:string[] = []
|
||||||
|
|
||||||
|
if(nowChatroom.type === 'group'){
|
||||||
|
formedChat = name + ': ' + formedChat
|
||||||
|
attr.push('nameAdded')
|
||||||
|
}
|
||||||
|
|
||||||
const chat:OpenAIChat = {
|
const chat:OpenAIChat = {
|
||||||
role: msg.role === 'user' ? 'user' : 'assistant',
|
role: msg.role === 'user' ? 'user' : 'assistant',
|
||||||
content: formedChat,
|
content: formedChat,
|
||||||
memo: msg.chatId,
|
memo: msg.chatId,
|
||||||
name: name
|
attr: attr
|
||||||
}
|
}
|
||||||
chats.push(chat)
|
chats.push(chat)
|
||||||
currentTokens += await tokenizer.tokenizeChat(chat)
|
currentTokens += await tokenizer.tokenizeChat(chat)
|
||||||
@@ -1269,8 +1277,13 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
function systemizeChat(chat:OpenAIChat[]){
|
function systemizeChat(chat:OpenAIChat[]){
|
||||||
for(let i=0;i<chat.length;i++){
|
for(let i=0;i<chat.length;i++){
|
||||||
if(chat[i].role === 'user' || chat[i].role === 'assistant'){
|
if(chat[i].role === 'user' || chat[i].role === 'assistant'){
|
||||||
chat[i].content = chat[i].role + ': ' + chat[i].content
|
const attr = chat[i].attr ?? []
|
||||||
|
if(!attr.includes('nameAdded')){
|
||||||
|
chat[i].content = chat[i].role + ': ' + chat[i].content
|
||||||
|
}
|
||||||
chat[i].role = 'system'
|
chat[i].role = 'system'
|
||||||
|
delete chat[i].memo
|
||||||
|
delete chat[i].name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return chat
|
return chat
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ export interface OpenAIChatExtra {
|
|||||||
memo?:string
|
memo?:string
|
||||||
name?:string
|
name?:string
|
||||||
removable?:boolean
|
removable?:boolean
|
||||||
|
attr?:string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -133,6 +134,7 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
raiModel = 'reverse_proxy'
|
raiModel = 'reverse_proxy'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(formated)
|
||||||
switch(raiModel){
|
switch(raiModel){
|
||||||
case 'gpt35':
|
case 'gpt35':
|
||||||
case 'gpt35_0613':
|
case 'gpt35_0613':
|
||||||
@@ -153,7 +155,6 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
case 'mistral-medium':
|
case 'mistral-medium':
|
||||||
case 'reverse_proxy':{
|
case 'reverse_proxy':{
|
||||||
let formatedChat:OpenAIChatExtra[] = []
|
let formatedChat:OpenAIChatExtra[] = []
|
||||||
console.log(formated)
|
|
||||||
if(db.inlayImage){
|
if(db.inlayImage){
|
||||||
let pendingImages:OpenAIImageContents[] = []
|
let pendingImages:OpenAIImageContents[] = []
|
||||||
for(let i=0;i<formated.length;i++){
|
for(let i=0;i<formated.length;i++){
|
||||||
@@ -192,10 +193,6 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
let oobaSystemPrompts:string[] = []
|
let oobaSystemPrompts:string[] = []
|
||||||
for(let i=0;i<formatedChat.length;i++){
|
for(let i=0;i<formatedChat.length;i++){
|
||||||
if(formatedChat[i].role !== 'function'){
|
if(formatedChat[i].role !== 'function'){
|
||||||
if(arg.isGroupChat && formatedChat[i].name){
|
|
||||||
formatedChat[i].content = formatedChat[i].name + ": " + formatedChat[i].content
|
|
||||||
formatedChat[i].name = undefined
|
|
||||||
}
|
|
||||||
if(!(formatedChat[i].name && formatedChat[i].name.startsWith('example_') && db.newOAIHandle)){
|
if(!(formatedChat[i].name && formatedChat[i].name.startsWith('example_') && db.newOAIHandle)){
|
||||||
formatedChat[i].name = undefined
|
formatedChat[i].name = undefined
|
||||||
}
|
}
|
||||||
@@ -204,6 +201,7 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
}
|
}
|
||||||
delete formatedChat[i].memo
|
delete formatedChat[i].memo
|
||||||
delete formatedChat[i].removable
|
delete formatedChat[i].removable
|
||||||
|
delete formatedChat[i].attr
|
||||||
}
|
}
|
||||||
if(aiModel === 'reverse_proxy' && db.reverseProxyOobaMode && formatedChat[i].role === 'system'){
|
if(aiModel === 'reverse_proxy' && db.reverseProxyOobaMode && formatedChat[i].role === 'system'){
|
||||||
const cont = formatedChat[i].content
|
const cont = formatedChat[i].content
|
||||||
|
|||||||
Reference in New Issue
Block a user