mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-15 22:06:52 +08:00
feat: advanced prompt (#1330)
Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: Gillian97 <jinling.sunshine@gmail.com>
This commit is contained in:
42
web/app/components/base/prompt-log-modal/card.tsx
Normal file
42
web/app/components/base/prompt-log-modal/card.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
import type { FC } from 'react'
|
||||
import { CopyFeedbackNew } from '@/app/components/base/copy-feedback'
|
||||
|
||||
type CardProps = {
|
||||
log: { role: string; text: string }[]
|
||||
}
|
||||
const Card: FC<CardProps> = ({
|
||||
log,
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
{
|
||||
log.length === 1 && (
|
||||
<div className='px-4 py-2'>
|
||||
<div className='whitespace-pre-line text-gray-700'>
|
||||
{log[0].text}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
{
|
||||
log.length > 1 && (
|
||||
<div>
|
||||
{
|
||||
log.map((item, index) => (
|
||||
<div key={index} className='group/card mb-2 px-4 pt-2 pb-4 rounded-xl hover:bg-gray-50 last-of-type:mb-0'>
|
||||
<div className='flex justify-between items-center h-8'>
|
||||
<div className='font-semibold text-[#2D31A6]'>{item.role.toUpperCase()}</div>
|
||||
<CopyFeedbackNew className='hidden w-6 h-6 group-hover/card:block' content={item.text} />
|
||||
</div>
|
||||
<div className='whitespace-pre-line text-gray-700'>{item.text}</div>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Card
|
||||
Reference in New Issue
Block a user