Skip to content

Commit

Permalink
feat: better animation speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Nov 19, 2023
1 parent 4f8a0b7 commit f248593
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app/client/platforms/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ export class ChatGPTApi implements LLMApi {
}

if (remainText.length > 0) {
responseText += remainText[0];
remainText = remainText.slice(1);
options.onUpdate?.(responseText, remainText[0]);
const fetchCount = Math.max(1, Math.round(remainText.length / 60));
const fetchText = remainText.slice(0, fetchCount);
responseText += fetchText;
remainText = remainText.slice(fetchCount);
options.onUpdate?.(responseText, fetchText);
}

requestAnimationFrame(animateResponseText);
Expand Down
2 changes: 1 addition & 1 deletion app/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export type { LocaleType, PartialLocaleType } from "./cn";
const ALL_LANGS = {
cn,
en,
pt,
tw,
pt,
jp,
ko,
id,
Expand Down
2 changes: 1 addition & 1 deletion app/locales/pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const pt: LocaleType = {
},
},
Lang: {
Name: "Idioma",
Name: "Language",
All: "Todos os Idiomas",
},
Avatar: "Avatar",
Expand Down

0 comments on commit f248593

Please sign in to comment.