Refactor Chatbox to improve AddImage component handling and button functionality

This commit is contained in:
ecwu
2024-12-25 16:12:10 +08:00
parent 60b1481dab
commit 08504930d4
3 changed files with 484 additions and 426 deletions

View File

@@ -803,7 +803,8 @@ export default function ChatBOX(props: {
<Button
variant="ghost"
size="icon"
onClick={() => setShowAddImage(!showAddImage)}
type="button"
onClick={() => setShowAddImage(true)}
disabled={showGenerating || !chatStore.apiKey}
>
<ImageIcon className="size-4" />
@@ -837,15 +838,14 @@ export default function ChatBOX(props: {
</div>
</form>
{showAddImage && (
<AddImage
chatStore={chatStore}
setChatStore={setChatStore}
setShowAddImage={setShowAddImage}
images={images}
setImages={setImages}
/>
)}
<AddImage
chatStore={chatStore}
setChatStore={setChatStore}
setShowAddImage={setShowAddImage}
images={images}
showAddImage={showAddImage}
setImages={setImages}
/>
</div>
</div>
</>