feat: mermory size config

This commit is contained in:
Joel
2024-02-29 14:50:36 +08:00
parent fbcc769d4e
commit 9e6940ed3e
8 changed files with 158 additions and 7 deletions

View File

@ -1,6 +1,6 @@
import { useCallback, useState } from 'react'
import produce from 'immer'
import type { ValueSelector } from '../../types'
import type { Memory, ValueSelector } from '../../types'
import type { QuestionClassifierNodeType } from './types'
const useConfig = (initInputs: QuestionClassifierNodeType) => {
@ -44,6 +44,13 @@ const useConfig = (initInputs: QuestionClassifierNodeType) => {
setInputs(newInputs)
}, [inputs, setInputs])
const handleMemoryChange = useCallback((memory: Memory) => {
const newInputs = produce(inputs, (draft) => {
draft.memory = memory
})
setInputs(newInputs)
}, [inputs, setInputs])
return {
inputs,
handleModelChanged,
@ -51,6 +58,7 @@ const useConfig = (initInputs: QuestionClassifierNodeType) => {
handleQueryVarChange,
handleTopicsChange,
handleInstructionChange,
handleMemoryChange,
}
}