mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	Merge pull request #5599 from ConnectAI-E/feature/allow-send-image-only
feat: allow send image only
This commit is contained in:
		@@ -115,11 +115,14 @@ import { getClientConfig } from "../config/client";
 | 
				
			|||||||
import { useAllModels } from "../utils/hooks";
 | 
					import { useAllModels } from "../utils/hooks";
 | 
				
			||||||
import { MultimodalContent } from "../client/api";
 | 
					import { MultimodalContent } from "../client/api";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const localStorage = safeLocalStorage();
 | 
					 | 
				
			||||||
import { ClientApi } from "../client/api";
 | 
					import { ClientApi } from "../client/api";
 | 
				
			||||||
import { createTTSPlayer } from "../utils/audio";
 | 
					import { createTTSPlayer } from "../utils/audio";
 | 
				
			||||||
import { MsEdgeTTS, OUTPUT_FORMAT } from "../utils/ms_edge_tts";
 | 
					import { MsEdgeTTS, OUTPUT_FORMAT } from "../utils/ms_edge_tts";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { isEmpty } from "lodash-es";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const localStorage = safeLocalStorage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ttsPlayer = createTTSPlayer();
 | 
					const ttsPlayer = createTTSPlayer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
 | 
					const Markdown = dynamic(async () => (await import("./markdown")).Markdown, {
 | 
				
			||||||
@@ -1015,7 +1018,7 @@ function _Chat() {
 | 
				
			|||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const doSubmit = (userInput: string) => {
 | 
					  const doSubmit = (userInput: string) => {
 | 
				
			||||||
    if (userInput.trim() === "") return;
 | 
					    if (userInput.trim() === "" && isEmpty(attachImages)) return;
 | 
				
			||||||
    const matchCommand = chatCommands.match(userInput);
 | 
					    const matchCommand = chatCommands.match(userInput);
 | 
				
			||||||
    if (matchCommand.matched) {
 | 
					    if (matchCommand.matched) {
 | 
				
			||||||
      setUserInput("");
 | 
					      setUserInput("");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -372,22 +372,16 @@ export const useChatStore = createPersistStore(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (attachImages && attachImages.length > 0) {
 | 
					        if (attachImages && attachImages.length > 0) {
 | 
				
			||||||
          mContent = [
 | 
					          mContent = [
 | 
				
			||||||
            {
 | 
					            ...(userContent
 | 
				
			||||||
              type: "text",
 | 
					              ? [{ type: "text" as const, text: userContent }]
 | 
				
			||||||
              text: userContent,
 | 
					              : []),
 | 
				
			||||||
            },
 | 
					            ...attachImages.map((url) => ({
 | 
				
			||||||
 | 
					              type: "image_url" as const,
 | 
				
			||||||
 | 
					              image_url: { url },
 | 
				
			||||||
 | 
					            })),
 | 
				
			||||||
          ];
 | 
					          ];
 | 
				
			||||||
          mContent = mContent.concat(
 | 
					 | 
				
			||||||
            attachImages.map((url) => {
 | 
					 | 
				
			||||||
              return {
 | 
					 | 
				
			||||||
                type: "image_url",
 | 
					 | 
				
			||||||
                image_url: {
 | 
					 | 
				
			||||||
                  url: url,
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
              };
 | 
					 | 
				
			||||||
            }),
 | 
					 | 
				
			||||||
          );
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let userMessage: ChatMessage = createMessage({
 | 
					        let userMessage: ChatMessage = createMessage({
 | 
				
			||||||
          role: "user",
 | 
					          role: "user",
 | 
				
			||||||
          content: mContent,
 | 
					          content: mContent,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user