Skip to content
Draft
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
5 changes: 3 additions & 2 deletions components/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import MessageDisplay from "./MessageDisplay";

import UserIcon from "./UserIcon";
import AssistantIcon from "./AssistantIcon";
import ZundamonIcon from "./ZundamonIcon";
import { Message } from "@/stores/Message";
import {
delMessage,
Expand Down Expand Up @@ -178,11 +179,11 @@ export default function ChatDisplay({ message }: { message: Message }) {
>
<MediaQuery smallerThan="md" styles={{ display: "none" }}>
<div className={classes.topOfMessage}>
<Avatar size="sm">
<Avatar size="xl">
{message.role === "system" ? (
<IconSettings />
) : message.role === "assistant" ? (
<AssistantIcon width={px("1.5rem")} height={px("1.5rem")} />
<ZundamonIcon number={message.pictureNumber} />
) : (
<UserIcon width={px("1.5rem")} height={px("1.5rem")} />
)}
Expand Down
34 changes: 34 additions & 0 deletions components/ZundamonIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Image from 'next/image';
import React from 'react';

// Propsの型定義
interface ImageComponentProps {
number: string | undefined;
}

const ImageComponent: React.FC<ImageComponentProps> = (props) => {
const { number } = props;

// 本来はnumberを使って何かしらの処理をするかもしれません
const parsedNumber = () => {
console.log("number: ", number)
if(number !== undefined) {
const match = number.match(/\{ select: (\d+) \}/);
const selectValue = match ? parseInt(match[1], 10) : null;
return selectValue
}
};

return (
<div>
<Image
src={`/zundamon/${parsedNumber() || "19"}.png`}
alt="Description of example1"
width={100}
height={100}
/>
</div>
);
};

export default ImageComponent;
Loading