新增自定义ai问片默认消息
This commit is contained in:
@@ -263,16 +263,16 @@ export default function AIChatPanel({
|
||||
<div className='relative mx-4 my-auto flex h-[85vh] sm:h-[80vh] max-h-[90vh] sm:max-h-[600px] w-full max-w-3xl flex-col rounded-2xl bg-white shadow-2xl dark:bg-gray-900'>
|
||||
{/* 头部 */}
|
||||
<div className='flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div className='flex h-10 w-10 items-center justify-center rounded-full bg-purple-500'>
|
||||
<div className='flex items-center gap-3 min-w-0 flex-1'>
|
||||
<div className='flex h-10 w-10 items-center justify-center rounded-full bg-purple-500 flex-shrink-0'>
|
||||
<Sparkles size={20} className='text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<h2 className='text-lg font-semibold text-gray-900 dark:text-white'>
|
||||
<div className='min-w-0 flex-1'>
|
||||
<h2 className='text-lg font-semibold text-gray-900 dark:text-white'>
|
||||
AI影视助手
|
||||
</h2>
|
||||
{context?.title && (
|
||||
<p className='text-xs text-gray-500 dark:text-gray-400'>
|
||||
<p className='text-xs text-gray-500 dark:text-gray-400 truncate'>
|
||||
正在讨论: {context.title}
|
||||
{context.year && ` (${context.year})`}
|
||||
</p>
|
||||
@@ -281,9 +281,9 @@ export default function AIChatPanel({
|
||||
</div>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className='rounded-lg p-2 text-gray-500 transition-colors hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800'
|
||||
className='rounded-lg p-2 text-gray-500 transition-colors hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800 flex-shrink-0'
|
||||
>
|
||||
<X size={20} />
|
||||
<X size={20} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -110,6 +110,7 @@ const VideoCard = forwardRef<VideoCardHandle, VideoCardProps>(function VideoCard
|
||||
const [searchFavorited, setSearchFavorited] = useState<boolean | null>(null); // 搜索结果的收藏状态
|
||||
const [showAIChat, setShowAIChat] = useState(false);
|
||||
const [aiEnabled, setAiEnabled] = useState(false);
|
||||
const [aiDefaultMessageWithVideo, setAiDefaultMessageWithVideo] = useState('');
|
||||
const [showDetailPanel, setShowDetailPanel] = useState(false);
|
||||
|
||||
// 检查AI功能是否启用
|
||||
@@ -119,6 +120,12 @@ const VideoCard = forwardRef<VideoCardHandle, VideoCardProps>(function VideoCard
|
||||
(window as any).RUNTIME_CONFIG?.AI_ENABLED &&
|
||||
(window as any).RUNTIME_CONFIG?.AI_ENABLE_VIDEOCARD_ENTRY;
|
||||
setAiEnabled(enabled);
|
||||
|
||||
// 加载AI默认消息配置
|
||||
const defaultMsg = (window as any).RUNTIME_CONFIG?.AI_DEFAULT_MESSAGE_WITH_VIDEO;
|
||||
if (defaultMsg) {
|
||||
setAiDefaultMessageWithVideo(defaultMsg);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
@@ -1468,7 +1475,7 @@ const VideoCard = forwardRef<VideoCardHandle, VideoCardProps>(function VideoCard
|
||||
type: actualSearchType as 'movie' | 'tv',
|
||||
currentEpisode,
|
||||
}}
|
||||
welcomeMessage={`想了解《${actualTitle}》的更多信息吗?我可以帮你查询剧情、演员、评价等。`}
|
||||
welcomeMessage={aiDefaultMessageWithVideo ? aiDefaultMessageWithVideo.replace('{title}', actualTitle || '') : `想了解《${actualTitle}》的更多信息吗?我可以帮你查询剧情、演员、评价等。`}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user