[feat] models base info
This commit is contained in:
@@ -20,6 +20,7 @@ import { HypaProcesser } from "./memory/hypamemory";
|
|||||||
import { additionalInformations } from "./embedding/addinfo";
|
import { additionalInformations } from "./embedding/addinfo";
|
||||||
import { cipherChat, decipherChat } from "./cipherChat";
|
import { cipherChat, decipherChat } from "./cipherChat";
|
||||||
import { getInlayImage, supportsInlayImage } from "../image";
|
import { getInlayImage, supportsInlayImage } from "../image";
|
||||||
|
import { getGenerationModelString } from "./models/modelString";
|
||||||
|
|
||||||
export interface OpenAIChat{
|
export interface OpenAIChat{
|
||||||
role: 'system'|'user'|'assistant'|'function'
|
role: 'system'|'user'|'assistant'|'function'
|
||||||
@@ -861,6 +862,8 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
if(abortSignal.aborted === true){
|
if(abortSignal.aborted === true){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
const generationId = v4()
|
||||||
|
const generationModel = getGenerationModelString()
|
||||||
if(req.type === 'fail'){
|
if(req.type === 'fail'){
|
||||||
alertError(req.result)
|
alertError(req.result)
|
||||||
return false
|
return false
|
||||||
@@ -878,7 +881,11 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
role: 'char',
|
role: 'char',
|
||||||
data: "",
|
data: "",
|
||||||
saying: currentChar.chaId,
|
saying: currentChar.chaId,
|
||||||
time: Date.now()
|
time: Date.now(),
|
||||||
|
generationInfo: {
|
||||||
|
model: generationModel,
|
||||||
|
generationId: generationId,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
db.characters[selectedChar].chats[selectedChat].isStreaming = true
|
db.characters[selectedChar].chats[selectedChat].isStreaming = true
|
||||||
@@ -936,7 +943,11 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
role: 'char',
|
role: 'char',
|
||||||
data: result,
|
data: result,
|
||||||
saying: currentChar.chaId,
|
saying: currentChar.chaId,
|
||||||
time: Date.now()
|
time: Date.now(),
|
||||||
|
generationInfo: {
|
||||||
|
model: generationModel,
|
||||||
|
generationId: generationId,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -944,7 +955,11 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
role: msg[0],
|
role: msg[0],
|
||||||
data: result,
|
data: result,
|
||||||
saying: currentChar.chaId,
|
saying: currentChar.chaId,
|
||||||
time: Date.now()
|
time: Date.now(),
|
||||||
|
generationInfo: {
|
||||||
|
model: generationModel,
|
||||||
|
generationId: generationId,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
db.characters[selectedChar].reloadKeys += 1
|
db.characters[selectedChar].reloadKeys += 1
|
||||||
|
|||||||
14
src/ts/process/models/modelString.ts
Normal file
14
src/ts/process/models/modelString.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { DataBase } from "src/ts/storage/database";
|
||||||
|
import { get } from "svelte/store";
|
||||||
|
|
||||||
|
export function getGenerationModelString(){
|
||||||
|
const db = get(DataBase)
|
||||||
|
switch (db.aiModel){
|
||||||
|
case 'reverse_proxy':
|
||||||
|
return 'reverse_proxy-' + (db.reverseProxyOobaMode ? 'ooba' : db.proxyRequestModel)
|
||||||
|
case 'openrouter':
|
||||||
|
return 'openrouter-' + db.openrouterRequestModel
|
||||||
|
default:
|
||||||
|
return db.aiModel
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -734,6 +734,12 @@ export interface Message{
|
|||||||
saying?: string
|
saying?: string
|
||||||
chatId?:string
|
chatId?:string
|
||||||
time?: number
|
time?: number
|
||||||
|
generationInfo?: MessageGenerationInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MessageGenerationInfo{
|
||||||
|
model?: string
|
||||||
|
generationId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AINsettings{
|
interface AINsettings{
|
||||||
|
|||||||
Reference in New Issue
Block a user