mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-07-28 11:18:21 +08:00
refactor: services
This commit is contained in:
@@ -7,7 +7,6 @@ export * from './get-client-position'
|
||||
export * from './get-conversation-pairs'
|
||||
export * from './get-core-content-text'
|
||||
export * from './get-possible-element-by-query-selector'
|
||||
export * from './init-session'
|
||||
export * from './is-edge'
|
||||
export * from './is-firefox'
|
||||
export * from './is-mobile'
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
import { Models } from '../config/index.mjs'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
/**
|
||||
* @typedef {object} Session
|
||||
* @property {string|null} question
|
||||
* @property {Object[]|null} conversationRecords
|
||||
* @property {string|null} sessionName
|
||||
* @property {string|null} sessionId
|
||||
* @property {string|null} createdAt
|
||||
* @property {string|null} updatedAt
|
||||
* @property {string|null} aiName
|
||||
* @property {string|null} modelName
|
||||
* @property {boolean|null} autoClean
|
||||
* @property {boolean} isRetry
|
||||
* @property {string|null} conversationId - chatGPT web mode
|
||||
* @property {string|null} messageId - chatGPT web mode
|
||||
* @property {string|null} parentMessageId - chatGPT web mode
|
||||
* @property {string|null} bingWeb_conversationSignature
|
||||
* @property {string|null} bingWeb_conversationId
|
||||
* @property {string|null} bingWeb_clientId
|
||||
* @property {string|null} bingWeb_invocationId
|
||||
* @property {string|null} bingWeb_jailbreakConversationId
|
||||
* @property {string|null} bingWeb_parentMessageId
|
||||
* @property {Object|null} bingWeb_jailbreakConversationCache
|
||||
* @property {number|null} poe_chatId
|
||||
*/
|
||||
/**
|
||||
* @param {string|null} question
|
||||
* @param {Object[]|null} conversationRecords
|
||||
* @param {string|null} sessionName
|
||||
* @param {string|null} modelName
|
||||
* @param {boolean|null} autoClean
|
||||
* @returns {Session}
|
||||
*/
|
||||
export function initSession({
|
||||
question = null,
|
||||
conversationRecords = [],
|
||||
sessionName = null,
|
||||
modelName = null,
|
||||
autoClean = true,
|
||||
} = {}) {
|
||||
return {
|
||||
// common
|
||||
question,
|
||||
conversationRecords,
|
||||
|
||||
sessionName,
|
||||
sessionId: uuidv4(),
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
|
||||
aiName: modelName ? Models[modelName].desc : null,
|
||||
modelName,
|
||||
|
||||
autoClean,
|
||||
isRetry: false,
|
||||
|
||||
// chatgpt-web
|
||||
conversationId: null,
|
||||
messageId: null,
|
||||
parentMessageId: null,
|
||||
|
||||
// bing
|
||||
bingWeb_conversationSignature: null,
|
||||
bingWeb_conversationId: null,
|
||||
bingWeb_clientId: null,
|
||||
bingWeb_invocationId: null,
|
||||
|
||||
// bing sydney
|
||||
bingWeb_jailbreakConversationId: null,
|
||||
bingWeb_parentMessageId: null,
|
||||
bingWeb_jailbreakConversationCache: null,
|
||||
|
||||
// poe
|
||||
poe_chatId: null,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user