UNPKG

koishi-plugin-newbingchat

Version:

不需要proxy即可使用的newbing AI,基于NewbingGoGo。

225 lines (224 loc) 9.51 kB
import WebSocket from 'ws'; import SendMessageManager from './tools/SendMessageManager'; import NewBingChat from '.'; export declare class NewBingSessionClass { static SessionMap: Map<string, NewBingSessionClass>; static RepCallbackMap: Map<string, Function>; userId: string; cookie: string; chatType: string; status: number; bingChatWs: WebSocket; msgManager: SendMessageManager; tempRevMsg?: string; throttling: { maxNumUserMessagesInConversation: 20; numUserMessagesInConversation: number; }; constructor(userId: string, cookie: string, chatType: string); sendMessage(msg: string, callback: Function): this; start(origin: string, msgFilter: NewBingChat.Config["msgFilter"]): Promise<void>; getAuth(origin: string): Promise<unknown>; static handleSuggested(data: NewBingSessionClass.suggestedType[]): string; static getChatSession(userId: string, config: NewBingChat.Config): NewBingSessionClass; } export declare namespace NewBingSessionClass { interface createData { conversationId: string; clientId: number; conversationSignature: string; result: { value: "Success" | "Failed"; message?: string; }; } interface suggestedType { "text": "有用,谢谢你。"; "author": "user"; "createdAt": "2023-05-22T02:28:05.5213297+00:00"; "timestamp": "2023-05-22T02:28:05.5213297+00:00"; "messageId": "d3c4f8cc-134d-47eb-b5fe-d239a933ce9e"; "messageType": "Suggestion"; "offense": "Unknown"; "feedback": { "tag": null; "updatedOn": null; "type": "None"; }; "contentOrigin": "SuggestionChipsFalconService"; "privacy": null; } interface msgType1 { "type": 1; "target": "update"; "arguments": [ { "messages": [ { "text": "你好,这是必应。我可以推荐一些好歌给你,不过这只是我的个人喜好,你可能有不同的口味。😊\n\n你喜欢什么样的"; "author": "bot"; "createdAt": "2023-05-22T10:37:37.9793792+00:00"; "timestamp": "2023-05-22T10:37:37.9793792+00:00"; "messageId": "1e0f59c8-b686-420e-a083-25666bc387dd"; "offense": "Unknown"; "adaptiveCards": [ { "type": "AdaptiveCard"; "version": "1.0"; "body": [ { "type": "TextBlock"; "text": "你好,这是必应。我可以推荐一些好歌给你,不过这只是我的个人喜好,你可能有不同的口味。😊\n\n你喜欢什么样的"; "wrap": true; } ]; } ]; "sourceAttributions": []; "feedback": { "tag": null; "updatedOn": null; "type": "None"; }; "contentOrigin": "DeepLeo"; "privacy": null; } ]; requestId: string; throttling?: { maxNumUserMessagesInConversation: 20; numUserMessagesInConversation: number; }; } ]; } interface msgType2 { "type": 2; "invocationId": "2"; "item": { "messages": [ { "text": "你还记得我的第一个问题吗?"; "author": "user"; "from": { "id": "985154540932869"; "name": null; }; "createdAt": "2023-05-22T02:27:47.2616792+00:00"; "timestamp": "2023-05-22T10:24:32+08:00"; "locale": "zh-CN"; "market": "zh-US"; "region": "US"; "location": "lat:47.639557;long:-122.128159;re=1000m;"; "locationHints": [ { "sourceType": 11; "center": { "latitude": 30.474104; "longitude": 114.396255; "height": null; }; "regionType": 2; }, { "country": "United States"; "countryConfidence": 9; "state": "Washington"; "city": "Index"; "zipCode": "98256"; "timeZoneOffset": -8; "dma": 819; "sourceType": 1; "center": { "latitude": 47.8201; "longitude": -121.5543; "height": null; }; "regionType": 2; } ]; "messageId": "f7da3055-6450-46b9-8bb1-006a9ebfbd90"; "requestId": "f7da3055-6450-46b9-8bb1-006a9ebfbd90"; "nlu": { "scoredClassification": { "classification": "DEEP_LEO"; "score": null; }; "classificationRanking": [ { "classification": "DEEP_LEO"; "score": null; } ]; "qualifyingClassifications": null; "ood": null; "metaData": null; "entities": null; }; "offense": "None"; "feedback": { "tag": null; "updatedOn": null; "type": "None"; }; "contentOrigin": "cib"; "privacy": null; "inputMethod": "Keyboard"; suggestedResponses?: suggestedType[]; }, { messageType?: string; "text": "当然记得,你问我知不知道怎么保持计划的可执行性。我回答了你的问题,你觉得有用吗?🤔"; "author": "bot"; "createdAt": "2023-05-22T02:28:01.3678586+00:00"; "timestamp": "2023-05-22T02:28:01.3678586+00:00"; "messageId": "7b8034ed-a2cd-481b-9b72-757127c14f91"; "requestId": "f7da3055-6450-46b9-8bb1-006a9ebfbd90"; "offense": "None"; "adaptiveCards": [ { "type": "AdaptiveCard"; "version": "1.0"; "body": [ { "type": "TextBlock"; "text": "当然记得,你问我知不知道怎么保持计划的可执行性。我回答了你的问题,你觉得有用吗 ?🤔\n"; "wrap": true; } ]; } ]; "sourceAttributions": []; "feedback": { "tag": null; "updatedOn": null; "type": "None"; }; "contentOrigin": "DeepLeo"; "privacy": null; "suggestedResponses": suggestedType[]; "spokenText": "我回答了你的问题,你觉得有用吗?"; } ]; "firstNewMessageIndex": 1; "defaultChatName": null; "conversationId": "51D|BingProd|47A3B024F44A230973FAE196C2DEA1EE90107BAC33D6A6A64EAED798349AB969"; "requestId": "f7da3055-6450-46b9-8bb1-006a9ebfbd90"; "conversationExpiryTime": "2023-05-22T08:28:05.5583657Z"; "telemetry": { "metrics": null; "startTime": "2023-05-22T02:24:34.0981729Z"; }; "throttling": { "maxNumUserMessagesInConversation": 20; "numUserMessagesInConversation": 2; }; "result": { "value": string; "message": "当然记得,你问我知不知道怎么保持计划的可执行性。我回答了你的问题,你觉得有用吗?🤔"; "serviceVersion": "20230519.153"; }; }; } var createData: createData; }