Skip to content

Commit 3c0ebae

Browse files
committed
feat: temperature not adjustable when its set by prompt
1 parent 8d8e3ae commit 3c0ebae

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/client/components/ChatV2/ChatV2.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ const ChatV2Content = () => {
7373

7474
const { userStatus, isLoading: statusLoading, refetch: refetchStatus } = useUserStatus(courseId)
7575

76-
const { user } = useCurrentUser()
77-
7876
// local storage states
7977
const localStoragePrefix = courseId ? `course-${courseId}` : 'general'
8078
const [activeModel, setActiveModel] = useLocalStorageStateWithURLDefault('model-v2', DEFAULT_MODEL, 'model', ValidModelNameSchema)

src/client/components/ChatV2/SettingsModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,12 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({ open, setOpen, mod
135135
min={0.0}
136136
max={1.0}
137137
step={0.1}
138-
value={modelTemperature}
138+
value={activePrompt?.temperature ?? modelTemperature}
139139
marks
140140
valueLabelDisplay="auto"
141141
name="Temperature"
142142
onChange={(_event, value) => setModelTemperature(typeof value === 'number' ? value : modelTemperature)}
143+
disabled={!!activePrompt?.temperature}
143144
/>
144145
<Box sx={{ display: 'flex', justifyContent: 'space-between' }}>
145146
<Typography>{t('settings:temperatureAccurate')}</Typography>

src/client/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export type Prompt = {
6767
createdAt: string
6868
ragIndexId?: number
6969
model?: ValidModelName
70+
temperature?: number
7071
}
7172

7273
export interface ChatInstance {

src/server/routes/ai/v3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ router.post('/stream', upload.single('file'), async (r, res) => {
127127
chatMessages: options.chatMessages,
128128
systemMessage,
129129
model: prompt?.model ?? generationInfo.model,
130-
temperature: options.modelTemperature,
130+
temperature: prompt?.temperature ?? options.modelTemperature,
131131
tools,
132132
writeEvent: async (event: ChatEvent) => {
133133
await new Promise((resolve) => {

0 commit comments

Comments
 (0)