app: polyfill Array.at

This fixes compatibility issue with older browsers like WeChat webview.
The summary feature now works as expected.
This commit is contained in:
Jun Wu
2023-04-01 11:38:52 -07:00
parent 327ac765df
commit cd5f8f7407
4 changed files with 20 additions and 1 deletions

View File

@@ -2,6 +2,10 @@ import type { ChatRequest, ChatReponse } from "./api/openai/typing";
import { filterConfig, Message, ModelConfig, useAccessStore } from "./store";
import Locale from "./locales";
if (!Array.prototype.at) {
require('array.prototype.at/auto');
}
const TIME_OUT_MS = 30000;
const makeRequestParam = (

View File

@@ -11,6 +11,10 @@ import { trimTopic } from "../utils";
import Locale from "../locales";
if (!Array.prototype.at) {
require('array.prototype.at/auto');
}
export type Message = ChatCompletionResponseMessage & {
date: string;
streaming?: boolean;