|
|
@@ -38,6 +38,8 @@ import BottomIcon from "../icons/bottom.svg";
|
|
|
import StopIcon from "../icons/pause.svg";
|
|
|
import RobotIcon from "../icons/robot.svg";
|
|
|
import SizeIcon from "../icons/size.svg";
|
|
|
+import QualityIcon from "../icons/hd.svg";
|
|
|
+import StyleIcon from "../icons/palette.svg";
|
|
|
import PluginIcon from "../icons/plugin.svg";
|
|
|
|
|
|
import {
|
|
|
@@ -69,7 +71,7 @@ import { uploadImage as uploadImageRemote } from "@/app/utils/chat";
|
|
|
import dynamic from "next/dynamic";
|
|
|
|
|
|
import { ChatControllerPool } from "../client/controller";
|
|
|
-import { DalleSize } from "../typing";
|
|
|
+import { DalleSize, DalleQuality, DalleStyle } from "../typing";
|
|
|
import { Prompt, usePromptStore } from "../store/prompt";
|
|
|
import Locale from "../locales";
|
|
|
|
|
|
@@ -485,9 +487,17 @@ export function ChatActions(props: {
|
|
|
const [showUploadImage, setShowUploadImage] = useState(false);
|
|
|
|
|
|
const [showSizeSelector, setShowSizeSelector] = useState(false);
|
|
|
+ const [showQualitySelector, setShowQualitySelector] = useState(false);
|
|
|
+ const [showStyleSelector, setShowStyleSelector] = useState(false);
|
|
|
const dalle3Sizes: DalleSize[] = ["1024x1024", "1792x1024", "1024x1792"];
|
|
|
+ const dalle3Qualitys: DalleQuality[] = ["standard", "hd"];
|
|
|
+ const dalle3Styles: DalleStyle[] = ["vivid", "natural"];
|
|
|
const currentSize =
|
|
|
chatStore.currentSession().mask.modelConfig?.size ?? "1024x1024";
|
|
|
+ const currentQuality =
|
|
|
+ chatStore.currentSession().mask.modelConfig?.quality ?? "standard";
|
|
|
+ const currentStyle =
|
|
|
+ chatStore.currentSession().mask.modelConfig?.style ?? "vivid";
|
|
|
|
|
|
useEffect(() => {
|
|
|
const show = isVisionModel(currentModel);
|
|
|
@@ -659,6 +669,60 @@ export function ChatActions(props: {
|
|
|
/>
|
|
|
)}
|
|
|
|
|
|
+ {isDalle3(currentModel) && (
|
|
|
+ <ChatAction
|
|
|
+ onClick={() => setShowQualitySelector(true)}
|
|
|
+ text={currentQuality}
|
|
|
+ icon={<QualityIcon />}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+
|
|
|
+ {showQualitySelector && (
|
|
|
+ <Selector
|
|
|
+ defaultSelectedValue={currentQuality}
|
|
|
+ items={dalle3Qualitys.map((m) => ({
|
|
|
+ title: m,
|
|
|
+ value: m,
|
|
|
+ }))}
|
|
|
+ onClose={() => setShowQualitySelector(false)}
|
|
|
+ onSelection={(q) => {
|
|
|
+ if (q.length === 0) return;
|
|
|
+ const quality = q[0];
|
|
|
+ chatStore.updateCurrentSession((session) => {
|
|
|
+ session.mask.modelConfig.quality = quality;
|
|
|
+ });
|
|
|
+ showToast(quality);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+
|
|
|
+ {isDalle3(currentModel) && (
|
|
|
+ <ChatAction
|
|
|
+ onClick={() => setShowStyleSelector(true)}
|
|
|
+ text={currentStyle}
|
|
|
+ icon={<StyleIcon />}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+
|
|
|
+ {showStyleSelector && (
|
|
|
+ <Selector
|
|
|
+ defaultSelectedValue={currentStyle}
|
|
|
+ items={dalle3Styles.map((m) => ({
|
|
|
+ title: m,
|
|
|
+ value: m,
|
|
|
+ }))}
|
|
|
+ onClose={() => setShowStyleSelector(false)}
|
|
|
+ onSelection={(s) => {
|
|
|
+ if (s.length === 0) return;
|
|
|
+ const style = s[0];
|
|
|
+ chatStore.updateCurrentSession((session) => {
|
|
|
+ session.mask.modelConfig.style = style;
|
|
|
+ });
|
|
|
+ showToast(style);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+
|
|
|
<ChatAction
|
|
|
onClick={() => setShowPluginSelector(true)}
|
|
|
text={Locale.Plugin.Name}
|