feat: support New Bing (GPT-4) (#49, #90)

This commit is contained in:
josc146
2023-03-26 23:29:03 +08:00
parent 6cb8bab762
commit 5d9d3c070f
12 changed files with 672 additions and 37 deletions
+26 -12
View File
@@ -1,27 +1,41 @@
/**
* @typedef {object} BingWeb
* @property {string|null} conversationSignature
* @property {string|null} conversationId
* @property {string|null} clientId
* @property {string|null} invocationId
*/
/**
* @typedef {object} Session
* @property {string|null} question
* @property {Object[]|null} conversationRecords
* @property {string|null} conversationId - chatGPT web mode
* @property {string|null} messageId - chatGPT web mode
* @property {string|null} parentMessageId - chatGPT web mode
* @property {Object[]|null} conversationRecords
* @property {BingWeb} bingWeb
*/
/**
* @param {Session} session
* @param {string|null} question
* @param {Object[]|null} conversationRecords
* @returns {Session}
*/
export function initSession({
question = null,
conversationId = null,
messageId = null,
parentMessageId = null,
conversationRecords = [],
} = {}) {
export function initSession({ question = null, conversationRecords = [] } = {}) {
return {
// common
question,
conversationId,
messageId,
parentMessageId,
conversationRecords,
// chatgpt-web
conversationId: null,
messageId: null,
parentMessageId: null,
// bing
bingWeb: {
conversationSignature: null,
conversationId: null,
clientId: null,
invocationId: null,
},
}
}