Skip to content

Commit

Permalink
fix: Set the max history messages to 9 (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
iRedScarf authored Sep 16, 2023
1 parent 72df7c6 commit d8d84d0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ PUBLIC_SECRET_KEY=
SITE_PASSWORD=
# ID of the model to use. https://platform.openai.com/docs/api-reference/models/list
OPENAI_API_MODEL=
# Set the maximum number of historical messages used for contextual contact
PUBLIC_MAX_HISTORY_MESSAGES=
3 changes: 2 additions & 1 deletion src/components/Generator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default () => {
const [isStick, setStick] = createSignal(false)
const [temperature, setTemperature] = createSignal(0.6);

Check failure on line 20 in src/components/Generator.tsx

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon
const temperatureSetting = (value: number) => { setTemperature(value) }
const maxHistoryMessages = parseInt(import.meta.env.PUBLIC_MAX_HISTORY_MESSAGES || '9')

createEffect(() => (isStick() && smoothToBottom()))

Expand Down Expand Up @@ -89,7 +90,7 @@ export default () => {
try {
const controller = new AbortController()
setController(controller)
const requestMessageList = [...messageList()]
const requestMessageList = messageList().slice(-maxHistoryMessages)
if (currentSystemRoleSettings()) {
requestMessageList.unshift({
role: 'system',
Expand Down
1 change: 1 addition & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface ImportMetaEnv {
readonly PUBLIC_SECRET_KEY: string
readonly SITE_PASSWORD: string
readonly OPENAI_API_MODEL: string
readonly PUBLIC_MAX_HISTORY_MESSAGES: string;

Check failure on line 11 in src/env.d.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected separator (;)
}

interface ImportMeta {
Expand Down

1 comment on commit d8d84d0

@vercel
Copy link

@vercel vercel bot commented on d8d84d0 Sep 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.