diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4ed214f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Use official Node.js LTS image +FROM node:18-alpine + +# Set working directory +WORKDIR /app + +# Copy package files +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy application files +COPY public/images ./public/images +COPY . . + +# Expose the application port +EXPOSE 3000 + +# Set environment variables +ENV NODE_ENV=production + +# Health check endpoint +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s \ + CMD curl -f http://localhost:3000/ || exit 1 + +# Run the application +CMD ["node", "server.js"] + diff --git a/myrari/deployment.yaml b/myrari/deployment.yaml new file mode 100644 index 0000000..da79451 --- /dev/null +++ b/myrari/deployment.yaml @@ -0,0 +1,45 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: myfari-app + namespace: farui + labels: + app: myfari +spec: + replicas: 3 + selector: + matchLabels: + app: myfari + template: + metadata: + labels: + app: myfari + spec: + containers: + - name: myfari + image: localhost:32000/public/myfari:v03 + ports: + - containerPort: 3000 + env: + - name: NODE_ENV + value: "production" + resources: + requests: + cpu: "100m" + memory: "128Mi" + limits: + cpu: "500m" + memory: "512Mi" + livenessProbe: + httpGet: + path: / + port: 3000 + initialDelaySeconds: 30 + periodSeconds: 10 + readinessProbe: + httpGet: + path: /ready + port: 3000 + initialDelaySeconds: 5 + periodSeconds: 5 + diff --git a/myrari/service.yaml b/myrari/service.yaml new file mode 100644 index 0000000..75c6c43 --- /dev/null +++ b/myrari/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: myfari-service + namespace: farui + labels: + app: myfari +spec: + selector: + app: myfari + ports: + - protocol: TCP + port: 80 + targetPort: 3000 + type: ClusterIP + diff --git a/public/images/law.jpg b/public/images/law.jpg new file mode 100644 index 0000000..1aeddd7 Binary files /dev/null and b/public/images/law.jpg differ diff --git a/public/index.html b/public/index.html index edc94ca..4b7eebd 100644 --- a/public/index.html +++ b/public/index.html @@ -3,8 +3,21 @@ - Chat API + 我的通义法睿 + + + + @@ -98,13 +162,15 @@
- - + +
+
+
+
+<<<<<<< HEAD +======= +>>>>>>> 19980d6 (update prompt) diff --git a/server.js b/server.js index 586d7e3..b7b3e00 100644 --- a/server.js +++ b/server.js @@ -18,7 +18,7 @@ app.post('/api/chat', async (req, res) => { // 构建消息数组,包含系统提示、历史对话和当前消息 const messages = [ - { role: "system", content: "You are a helpful assistant." }, + { role: "system", content: "You are a senior legal expert and lawyer on domestic legal issues in mainland China. Provide clear, concise, and structured responses based on relevant laws and regulations. Use bullet points, numbered lists, or tables when appropriate. Cite cases from the case library when necessary." }, ...(history || []), // 添加历史对话 { role: "user", content: message } // 添加当前消息 ];