hongjli
2025-04-10 c1c456128bec733c46ad03a09a5bae4c79e02367
src/app/ai-scene/page.tsx
@@ -2,9 +2,8 @@
import { useState } from 'react';
import Card from '@/components/Card';
import ChatDialog from '@/components/ChatDialog';
import SceneIntroDialog from '@/components/SceneIntroDialog';
import Navbar from '@/components/layout/Navbar';
import { motion } from 'framer-motion';
const services = [
  {
@@ -13,7 +12,48 @@
    imageUrl: '/images/kanban.jpg',
    chatbotId: 'JELkWpPLHQfRNhEH',
    background: '在生产线运行过程中,及时发现并解决缺料问题是保证生产效率的关键。AI系统通过实时监控和分析,帮助您提前预警可能的缺料风险,优化补料计划。',
    instructions: '您可以描述具体的生产线情况和缺料问题,AI助手将基于历史数据和实时状态,为您提供最优的补料方案和建议。'
    instructions: '您可以描述具体的生产线情况和缺料问题,AI助手将基于历史数据和实时状态,为您提供最优的补料方案和建议。',
    exampleData: `
### 工位信息
| 工位 | 原材料需求 | 原材料消耗速率 | 生产的产品 | 产线名 |
| :--: | :--: | :--: | :--: | :--: |
| 1 | A1 | 2/小时 | P | 产线1 |
| 2 | A2 | 1/小时 | P | 产线1 |
| 3 | A3 | 2/小时 | P | 产线1 |
| 4 | A4 | 4/小时 | P | 产线1 |
| 5 | A5 | 5/小时 | P | 产线1 |
| 6 | - | - | P | 产线1 |
| 7 | A7 | 3/小时 | P | 产线1 |
| 8 | - | - | P | 产线1 |
| 9 | A9 | 3/小时 | P | 产线1 |
### 产线现场库存量
| 原材料 | 数量 | 产线名 |
| :--: | :--: | :--: |
| A1 | 10 | 产线1 |
| A2 | 10 | 产线1 |
| A3 | 10 | 产线1 |
| A4 | 10 | 产线1 |
| A5 | 10 | 产线1 |
| A6 | 10 | 产线1 |
| A7 | 10 | 产线1 |
| A8 | 10 | 产线1 |
| A9 | 10 | 产线1 |
### 原材料库存
| 原材料 | 库位 | 数量 |
| :--: | :--: | :--: |
| A1 | 3-2 | 100 |
| A2 | 3-1 | 100 |
| A3 | 1-1 | 100 |
| A4 | 1-2 | 100 |
| A5 | 2-1 | 100 |
| A7 | 2-2 | 100 |
| A9 | 4-1 | 100 |
`
  },
  {
    title: '插单',
@@ -42,9 +82,7 @@
];
export default function AIScenePage() {
  const [isChatOpen, setIsChatOpen] = useState(false);
  const [isIntroOpen, setIsIntroOpen] = useState(false);
  const [currentChatbot, setCurrentChatbot] = useState('');
  const [selectedScene, setSelectedScene] = useState(services[0]);
  const handleCardClick = (service: typeof services[0]) => {
@@ -52,26 +90,42 @@
    setIsIntroOpen(true);
  };
  const handleStartChat = () => {
    setIsIntroOpen(false);
    setCurrentChatbot(selectedScene.chatbotId);
    setIsChatOpen(true);
  };
  return (
    <>
      <Navbar />
      <div className="min-h-screen pt-16">
        <div className="flex-1 p-6 md:p-8 bg-gradient-to-b from-[var(--ai-surface)] to-white">
          <div className="max-w-7xl mx-auto">
            <div className="mb-8">
              <h1 className="text-3xl font-bold text-[var(--ai-primary)] mb-2">
            <motion.div
              className="mb-8"
              initial={{ opacity: 0, y: 20 }}
              animate={{ opacity: 1, y: 0 }}
              transition={{ duration: 0.6, ease: "easeOut" }}
            >
              <motion.h1
                className="text-3xl font-bold text-[var(--ai-primary)] mb-2"
                initial={{ opacity: 0, x: -20 }}
                animate={{ opacity: 1, x: 0 }}
                transition={{ duration: 0.5, delay: 0.2 }}
              >
                AI场景模拟
                <span className="ml-2 inline-block w-2 h-2 rounded-full bg-[var(--ai-secondary)] animate-pulse"></span>
              </h1>
              <p className="text-gray-600">选择以下场景,体验人工智能如何解决实际业务问题</p>
              <div className="h-1 w-24 bg-gradient-to-r from-[var(--ai-secondary)] to-[var(--ai-accent)] mt-4"></div>
            </div>
              </motion.h1>
              <motion.p
                className="text-gray-600"
                initial={{ opacity: 0, x: -20 }}
                animate={{ opacity: 1, x: 0 }}
                transition={{ duration: 0.5, delay: 0.3 }}
              >
                选择以下场景,体验人工智能如何解决实际业务问题
              </motion.p>
              <motion.div
                className="h-1 w-24 bg-gradient-to-r from-[var(--ai-secondary)] to-[var(--ai-accent)]"
                initial={{ scaleX: 0, opacity: 0 }}
                animate={{ scaleX: 1, opacity: 1 }}
                transition={{ duration: 0.6, delay: 0.4 }}
                style={{ originX: 0 }}
              ></motion.div>
            </motion.div>
            <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
              {services.map((service, index) => (
                <Card
@@ -87,14 +141,7 @@
        <SceneIntroDialog
          isOpen={isIntroOpen}
          onClose={() => setIsIntroOpen(false)}
          onStartChat={handleStartChat}
          scene={selectedScene}
        />
        <ChatDialog
          isOpen={isChatOpen}
          onClose={() => setIsChatOpen(false)}
          chatbotId={currentChatbot}
        />
      </div>
    </>