Skip to content

Commit

Permalink
feat: fixed an issue where the default value for temperature was not …
Browse files Browse the repository at this point in the history
…set when creating a new chat and install remark-gfm so that the markdown table can be displayed (infiniflow#124)

* feat: install remark-gfm so that the markdown table can be displayed

* feat: fixed an issue where the default value for temperature was not set when creating a new chat
  • Loading branch information
cike8899 authored Mar 15, 2024
1 parent 9fe9fc4 commit 79f4fcc
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 20 deletions.
205 changes: 205 additions & 0 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"react-markdown": "^9.0.1",
"react-pdf-highlighter": "^6.1.0",
"react-string-replace": "^1.1.1",
"remark-gfm": "^4.0.0",
"umi": "^4.0.90",
"umi-request": "^1.4.0",
"unist-util-visit-parents": "^6.0.1",
Expand Down
7 changes: 7 additions & 0 deletions web/src/pages/chat/chat-configuration-modal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { ReactComponent as ChatConfigurationAtom } from '@/assets/svg/chat-configuration-atom.svg';
import { IModalManagerChildrenProps } from '@/components/modal-manager';
import {
ModelVariableType,
settledModelVariableMap,
} from '@/constants/knowledge';
import { IDialog } from '@/interfaces/database/chat';
import { Divider, Flex, Form, Modal, Segmented, UploadFile } from 'antd';
import { SegmentedValue } from 'antd/es/segmented';
Expand Down Expand Up @@ -130,6 +134,9 @@ const ChatConfigurationModal = ({
}
form.setFieldsValue({
...initialDialog,
llm_setting:
initialDialog.llm_setting ??
settledModelVariableMap[ModelVariableType.Precise],
icon: fileList,
llm_id: initialDialog.llm_id ?? modelId,
});
Expand Down
28 changes: 18 additions & 10 deletions web/src/pages/chat/chat-configuration-modal/model-setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ const ModelSetting = ({ show, form }: ISegmentedContentProps) => {
<Form.Item
name={['llm_setting', 'temperature']}
noStyle
rules={[{ required: true, message: 'Province is required' }]}
rules={[{ required: true, message: 'Temperature is required' }]}
>
<Slider className={styles.variableSlider} max={1} step={0.01} />
</Form.Item>
</Flex>
<Form.Item
name={['llm_setting', 'temperature']}
noStyle
rules={[{ required: true, message: 'Street is required' }]}
rules={[{ required: true, message: 'Temperature is required' }]}
>
<InputNumber
className={styles.sliderInputNumber}
Expand All @@ -103,15 +103,15 @@ const ModelSetting = ({ show, form }: ISegmentedContentProps) => {
<Form.Item
name={['llm_setting', 'top_p']}
noStyle
rules={[{ required: true, message: 'Province is required' }]}
rules={[{ required: true, message: 'Top_p is required' }]}
>
<Slider className={styles.variableSlider} max={1} step={0.01} />
</Form.Item>
</Flex>
<Form.Item
name={['llm_setting', 'top_p']}
noStyle
rules={[{ required: true, message: 'Street is required' }]}
rules={[{ required: true, message: 'Top_p is required' }]}
>
<InputNumber
className={styles.sliderInputNumber}
Expand All @@ -135,15 +135,19 @@ const ModelSetting = ({ show, form }: ISegmentedContentProps) => {
<Form.Item
name={['llm_setting', 'presence_penalty']}
noStyle
rules={[{ required: true, message: 'Province is required' }]}
rules={[
{ required: true, message: 'Presence Penalty is required' },
]}
>
<Slider className={styles.variableSlider} max={1} step={0.01} />
</Form.Item>
</Flex>
<Form.Item
name={['llm_setting', 'presence_penalty']}
noStyle
rules={[{ required: true, message: 'Street is required' }]}
rules={[
{ required: true, message: 'Presence Penalty is required' },
]}
>
<InputNumber
className={styles.sliderInputNumber}
Expand All @@ -167,15 +171,19 @@ const ModelSetting = ({ show, form }: ISegmentedContentProps) => {
<Form.Item
name={['llm_setting', 'frequency_penalty']}
noStyle
rules={[{ required: true, message: 'Province is required' }]}
rules={[
{ required: true, message: 'Frequency Penalty is required' },
]}
>
<Slider className={styles.variableSlider} max={1} step={0.01} />
</Form.Item>
</Flex>
<Form.Item
name={['llm_setting', 'frequency_penalty']}
noStyle
rules={[{ required: true, message: 'Street is required' }]}
rules={[
{ required: true, message: 'Frequency Penalty is required' },
]}
>
<InputNumber
className={styles.sliderInputNumber}
Expand All @@ -195,15 +203,15 @@ const ModelSetting = ({ show, form }: ISegmentedContentProps) => {
<Form.Item
name={['llm_setting', 'max_tokens']}
noStyle
rules={[{ required: true, message: 'Province is required' }]}
rules={[{ required: true, message: 'Max Tokens is required' }]}
>
<Slider className={styles.variableSlider} max={2048} />
</Form.Item>
</Flex>
<Form.Item
name={['llm_setting', 'max_tokens']}
noStyle
rules={[{ required: true, message: 'Street is required' }]}
rules={[{ required: true, message: 'Max Tokens is required' }]}
>
<InputNumber
className={styles.sliderInputNumber}
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/chat/chat-container/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
width: 70%;
}
.messageItemSectionRight {
width: 30%;
width: 40%;
}
.messageItemContent {
display: inline-flex;
Expand Down
Loading

0 comments on commit 79f4fcc

Please sign in to comment.