This commit is contained in:
Hk-Gosuto
2024-04-07 18:00:21 +08:00
parent 7382ce48bb
commit b00e9f0c79
17 changed files with 307 additions and 122 deletions

View File

@@ -509,14 +509,13 @@ export function ChatActions(props: {
const [showUploadImage, setShowUploadImage] = useState(false);
const [showUploadFile, setShowUploadFile] = useState(false);
const accessStore = useAccessStore();
useEffect(() => {
const show = isVisionModel(currentModel);
setShowUploadImage(show);
const serverConfig = getServerSideConfig();
setShowUploadFile(
serverConfig.isEnableRAG && !show && isSupportRAGModel(currentModel),
);
const isEnableRAG = !!process.env.NEXT_PUBLIC_ENABLE_RAG;
setShowUploadFile(isEnableRAG && !show && isSupportRAGModel(currentModel));
if (!show) {
props.setAttachImages([]);
props.setUploading(false);
@@ -1039,7 +1038,9 @@ function _Chat() {
setIsLoading(true);
const textContent = getMessageTextContent(userMessage);
const images = getMessageImages(userMessage);
chatStore.onUserInput(textContent, images).then(() => setIsLoading(false));
chatStore
.onUserInput(textContent, images, userMessage.fileInfos)
.then(() => setIsLoading(false));
inputRef.current?.focus();
};