Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 17, 2023
2 parents 8287aba + d8d84d0 commit b08799d
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);
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;
}

interface ImportMeta {
Expand Down

0 comments on commit b08799d

Please sign in to comment.