forked from XiaoMo/ChatGPT-Next-Web
Merge pull request #271 from RugerMcCarthy/feat/send_preview_option
feat: add switch of send preview bubble
This commit is contained in:
commit
e248e9196a
@ -292,6 +292,8 @@ export function Chat(props: {
|
|||||||
const latestMessageRef = useRef<HTMLDivElement>(null);
|
const latestMessageRef = useRef<HTMLDivElement>(null);
|
||||||
const [autoScroll, setAutoScroll] = useState(true);
|
const [autoScroll, setAutoScroll] = useState(true);
|
||||||
|
|
||||||
|
const config = useChatStore((state) => state.config);
|
||||||
|
|
||||||
// preview messages
|
// preview messages
|
||||||
const messages = (session.messages as RenderMessage[])
|
const messages = (session.messages as RenderMessage[])
|
||||||
.concat(
|
.concat(
|
||||||
@ -305,15 +307,14 @@ export function Chat(props: {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
)
|
).concat(
|
||||||
.concat(
|
userInput.length > 0 && config.sendPreviewBubble
|
||||||
userInput.length > 0
|
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
role: "user",
|
role: "user",
|
||||||
content: userInput,
|
content: userInput,
|
||||||
date: new Date().toLocaleString(),
|
date: new Date().toLocaleString(),
|
||||||
preview: true,
|
preview: false,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
|
@ -278,6 +278,18 @@ export function Settings(props: { closeSettings: () => void }) {
|
|||||||
}
|
}
|
||||||
></input>
|
></input>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
|
||||||
|
<SettingItem title={Locale.Settings.SendPreviewBubble}>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={config.sendPreviewBubble}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateConfig(
|
||||||
|
(config) => (config.sendPreviewBubble = e.currentTarget.checked),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
></input>
|
||||||
|
</SettingItem>
|
||||||
</List>
|
</List>
|
||||||
<List>
|
<List>
|
||||||
<SettingItem
|
<SettingItem
|
||||||
|
@ -77,6 +77,7 @@ const cn = {
|
|||||||
SendKey: "发送键",
|
SendKey: "发送键",
|
||||||
Theme: "主题",
|
Theme: "主题",
|
||||||
TightBorder: "紧凑边框",
|
TightBorder: "紧凑边框",
|
||||||
|
SendPreviewBubble: "发送预览气泡",
|
||||||
Prompt: {
|
Prompt: {
|
||||||
Disable: {
|
Disable: {
|
||||||
Title: "禁用提示词自动补全",
|
Title: "禁用提示词自动补全",
|
||||||
|
@ -78,6 +78,7 @@ const en: LocaleType = {
|
|||||||
SendKey: "Send Key",
|
SendKey: "Send Key",
|
||||||
Theme: "Theme",
|
Theme: "Theme",
|
||||||
TightBorder: "Tight Border",
|
TightBorder: "Tight Border",
|
||||||
|
SendPreviewBubble: "Send Preview Bubble",
|
||||||
Prompt: {
|
Prompt: {
|
||||||
Disable: {
|
Disable: {
|
||||||
Title: "Disable auto-completion",
|
Title: "Disable auto-completion",
|
||||||
|
@ -77,6 +77,7 @@ const tw: LocaleType = {
|
|||||||
SendKey: "發送鍵",
|
SendKey: "發送鍵",
|
||||||
Theme: "主題",
|
Theme: "主題",
|
||||||
TightBorder: "緊湊邊框",
|
TightBorder: "緊湊邊框",
|
||||||
|
SendPreviewBubble: "發送預覽氣泡",
|
||||||
Prompt: {
|
Prompt: {
|
||||||
Disable: {
|
Disable: {
|
||||||
Title: "停用提示詞自動補全",
|
Title: "停用提示詞自動補全",
|
||||||
|
@ -43,6 +43,7 @@ export interface ChatConfig {
|
|||||||
fontSize: number;
|
fontSize: number;
|
||||||
theme: Theme;
|
theme: Theme;
|
||||||
tightBorder: boolean;
|
tightBorder: boolean;
|
||||||
|
sendPreviewBubble: boolean;
|
||||||
|
|
||||||
disablePromptHint: boolean;
|
disablePromptHint: boolean;
|
||||||
|
|
||||||
@ -132,6 +133,7 @@ const DEFAULT_CONFIG: ChatConfig = {
|
|||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
theme: Theme.Auto as Theme,
|
theme: Theme.Auto as Theme,
|
||||||
tightBorder: false,
|
tightBorder: false,
|
||||||
|
sendPreviewBubble: true,
|
||||||
|
|
||||||
disablePromptHint: false,
|
disablePromptHint: false,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user