Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Quick NewChat Action #4333

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import AutoIcon from "../icons/auto.svg";
import BottomIcon from "../icons/bottom.svg";
import StopIcon from "../icons/pause.svg";
import RobotIcon from "../icons/robot.svg";
import AddIcon from "../icons/add.svg";

import {
ChatMessage,
Expand Down Expand Up @@ -97,6 +98,8 @@ import { ExportMessageModal } from "./exporter";
import { getClientConfig } from "../config/client";
import { useAllModels } from "../utils/hooks";
import { MultimodalContent } from "../client/api";
import { InputRange } from "./input-range";
import { config } from "process";

const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
loading: () => <LoadingIcon />,
Expand Down Expand Up @@ -555,6 +558,15 @@ export function ChatActions(props: {
icon={<RobotIcon />}
/>

<ChatAction
text={Locale.Chat.InputActions.NewChat}
icon={<AddIcon />}
onClick={() => {
chatStore.newSession(chatStore.currentSession().mask);
navigate(Path.Chat);
}}
/>

{showModelSelector && (
<Selector
defaultSelectedValue={currentModel}
Expand Down Expand Up @@ -1100,11 +1112,13 @@ function _Chat() {
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const handlePaste = useCallback(
async (event: React.ClipboardEvent<HTMLTextAreaElement>) => {
const currentModel = chatStore.currentSession().mask.modelConfig.model;
if(!isVisionModel(currentModel)){return;}
if (!isVisionModel(currentModel)) {
return;
}
const items = (event.clipboardData || window.clipboardData).items;
for (const item of items) {
if (item.kind === "file" && item.type.startsWith("image/")) {
Expand Down
1 change: 1 addition & 0 deletions app/locales/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const cn = {
Prompt: "快捷指令",
Masks: "所有面具",
Clear: "清除聊天",
NewChat: "另起聊天",
Settings: "对话设置",
UploadImage: "上传图片",
},
Expand Down
1 change: 1 addition & 0 deletions app/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const en: LocaleType = {
Prompt: "Prompts",
Masks: "Masks",
Clear: "Clear Context",
NewChat: "New Chat",
Settings: "Settings",
UploadImage: "Upload Images",
},
Expand Down
Loading