Compare commits
	
		
			15 Commits
		
	
	
		
			master
			...
			prod-yantu
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | b15b67c001 | ||
|   | 4157d58b4e | ||
|   | fb96576ebf | ||
|   | c5ff7bf59c | ||
|   | d82eb30c02 | ||
|   | 9b9db31145 | ||
|   | 58ffb70ec8 | ||
|   | c56a1ca9e1 | ||
|   | bc1ee53e43 | ||
|   | 7d263bca35 | ||
|   | 7f3014905e | ||
|   | b78c644adc | ||
|   | cd31c3a48a | ||
|   | 0ca652c37c | ||
|   | fefc554f2b | 
							
								
								
									
										24
									
								
								.gitea/charts/Chart.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								.gitea/charts/Chart.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | ||||
| apiVersion: v2 | ||||
| name: homeland | ||||
| description: A Helm chart for Kubernetes | ||||
| 
 | ||||
| # A chart can be either an 'application' or a 'library' chart. | ||||
| # | ||||
| # Application charts are a collection of templates that can be packaged into versioned archives | ||||
| # to be deployed. | ||||
| # | ||||
| # Library charts provide useful utilities or functions for the chart developer. They're included as | ||||
| # a dependency of application charts to inject those utilities and functions into the rendering | ||||
| # pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||||
| type: application | ||||
| 
 | ||||
| # This is the chart version. This version number should be incremented each time you make changes | ||||
| # to the chart and its templates, including the app version. | ||||
| # Versions are expected to follow Semantic Versioning (https://semver.org/) | ||||
| version: 0.1.0 | ||||
| 
 | ||||
| # This is the version number of the application being deployed. This version number should be | ||||
| # incremented each time you make changes to the application. Versions are not expected to | ||||
| # follow Semantic Versioning. They should reflect the version the application is using. | ||||
| # It is recommended to use it with quotes. | ||||
| appVersion: "1.16.0" | ||||
							
								
								
									
										22
									
								
								.gitea/charts/templates/NOTES.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								.gitea/charts/templates/NOTES.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| 1. Get the application URL by running these commands: | ||||
| {{- if .Values.ingress.enabled }} | ||||
| {{- range $host := .Values.ingress.hosts }} | ||||
|   {{- range .paths }} | ||||
|   http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} | ||||
|   {{- end }} | ||||
| {{- end }} | ||||
| {{- else if contains "NodePort" .Values.service.type }} | ||||
|   export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "homeland.fullname" . }}) | ||||
|   export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||||
|   echo http://$NODE_IP:$NODE_PORT | ||||
| {{- else if contains "LoadBalancer" .Values.service.type }} | ||||
|      NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||||
|            You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "homeland.fullname" . }}' | ||||
|   export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "homeland.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||||
|   echo http://$SERVICE_IP:{{ .Values.service.port }} | ||||
| {{- else if contains "ClusterIP" .Values.service.type }} | ||||
|   export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "homeland.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||||
|   export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||||
|   echo "Visit http://127.0.0.1:8080 to use your application" | ||||
|   kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||||
| {{- end }} | ||||
							
								
								
									
										62
									
								
								.gitea/charts/templates/_helpers.tpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								.gitea/charts/templates/_helpers.tpl
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,62 @@ | ||||
| {{/* | ||||
| Expand the name of the chart. | ||||
| */}} | ||||
| {{- define "homeland.name" -}} | ||||
| {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||||
| {{- end }} | ||||
| 
 | ||||
| {{/* | ||||
| Create a default fully qualified app name. | ||||
| We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||||
| If release name contains chart name it will be used as a full name. | ||||
| */}} | ||||
| {{- define "homeland.fullname" -}} | ||||
| {{- if .Values.fullnameOverride }} | ||||
| {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||||
| {{- else }} | ||||
| {{- $name := default .Chart.Name .Values.nameOverride }} | ||||
| {{- if contains $name .Release.Name }} | ||||
| {{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||||
| {{- else }} | ||||
| {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||||
| {{- end }} | ||||
| {{- end }} | ||||
| {{- end }} | ||||
| 
 | ||||
| {{/* | ||||
| Create chart name and version as used by the chart label. | ||||
| */}} | ||||
| {{- define "homeland.chart" -}} | ||||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||||
| {{- end }} | ||||
| 
 | ||||
| {{/* | ||||
| Common labels | ||||
| */}} | ||||
| {{- define "homeland.labels" -}} | ||||
| helm.sh/chart: {{ include "homeland.chart" . }} | ||||
| {{ include "homeland.selectorLabels" . }} | ||||
| {{- if .Chart.AppVersion }} | ||||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||||
| {{- end }} | ||||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||||
| {{- end }} | ||||
| 
 | ||||
| {{/* | ||||
| Selector labels | ||||
| */}} | ||||
| {{- define "homeland.selectorLabels" -}} | ||||
| app.kubernetes.io/name: {{ include "homeland.name" . }} | ||||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||||
| {{- end }} | ||||
| 
 | ||||
| {{/* | ||||
| Create the name of the service account to use | ||||
| */}} | ||||
| {{- define "homeland.serviceAccountName" -}} | ||||
| {{- if .Values.serviceAccount.create }} | ||||
| {{- default (include "homeland.fullname" .) .Values.serviceAccount.name }} | ||||
| {{- else }} | ||||
| {{- default "default" .Values.serviceAccount.name }} | ||||
| {{- end }} | ||||
| {{- end }} | ||||
							
								
								
									
										61
									
								
								.gitea/charts/templates/deployment.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								.gitea/charts/templates/deployment.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,61 @@ | ||||
| apiVersion: apps/v1 | ||||
| kind: Deployment | ||||
| metadata: | ||||
|   name: {{ include "homeland.fullname" . }} | ||||
|   labels: | ||||
|     {{- include "homeland.labels" . | nindent 4 }} | ||||
| spec: | ||||
|   {{- if not .Values.autoscaling.enabled }} | ||||
|   replicas: {{ .Values.replicaCount }} | ||||
|   {{- end }} | ||||
|   selector: | ||||
|     matchLabels: | ||||
|       {{- include "homeland.selectorLabels" . | nindent 6 }} | ||||
|   template: | ||||
|     metadata: | ||||
|       {{- with .Values.podAnnotations }} | ||||
|       annotations: | ||||
|         {{- toYaml . | nindent 8 }} | ||||
|       {{- end }} | ||||
|       labels: | ||||
|         {{- include "homeland.selectorLabels" . | nindent 8 }} | ||||
|     spec: | ||||
|       {{- with .Values.imagePullSecrets }} | ||||
|       imagePullSecrets: | ||||
|         {{- toYaml . | nindent 8 }} | ||||
|       {{- end }} | ||||
|       serviceAccountName: {{ include "homeland.serviceAccountName" . }} | ||||
|       securityContext: | ||||
|         {{- toYaml .Values.podSecurityContext | nindent 8 }} | ||||
|       containers: | ||||
|         - name: {{ .Chart.Name }} | ||||
|           securityContext: | ||||
|             {{- toYaml .Values.securityContext | nindent 12 }} | ||||
|           image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||||
|           imagePullPolicy: {{ .Values.image.pullPolicy }} | ||||
|           ports: | ||||
|             - name: http | ||||
|               containerPort: {{ .Values.service.port }} | ||||
|               protocol: TCP | ||||
|           livenessProbe: | ||||
|             httpGet: | ||||
|               path: / | ||||
|               port: http | ||||
|           readinessProbe: | ||||
|             httpGet: | ||||
|               path: / | ||||
|               port: http | ||||
|           resources: | ||||
|             {{- toYaml .Values.resources | nindent 12 }} | ||||
|       {{- with .Values.nodeSelector }} | ||||
|       nodeSelector: | ||||
|         {{- toYaml . | nindent 8 }} | ||||
|       {{- end }} | ||||
|       {{- with .Values.affinity }} | ||||
|       affinity: | ||||
|         {{- toYaml . | nindent 8 }} | ||||
|       {{- end }} | ||||
|       {{- with .Values.tolerations }} | ||||
|       tolerations: | ||||
|         {{- toYaml . | nindent 8 }} | ||||
|       {{- end }} | ||||
							
								
								
									
										32
									
								
								.gitea/charts/templates/hpa.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								.gitea/charts/templates/hpa.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | ||||
| {{- if .Values.autoscaling.enabled }} | ||||
| apiVersion: autoscaling/v2 | ||||
| kind: HorizontalPodAutoscaler | ||||
| metadata: | ||||
|   name: {{ include "homeland.fullname" . }} | ||||
|   labels: | ||||
|     {{- include "homeland.labels" . | nindent 4 }} | ||||
| spec: | ||||
|   scaleTargetRef: | ||||
|     apiVersion: apps/v1 | ||||
|     kind: Deployment | ||||
|     name: {{ include "homeland.fullname" . }} | ||||
|   minReplicas: {{ .Values.autoscaling.minReplicas }} | ||||
|   maxReplicas: {{ .Values.autoscaling.maxReplicas }} | ||||
|   metrics: | ||||
|     {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} | ||||
|     - type: Resource | ||||
|       resource: | ||||
|         name: cpu | ||||
|         target: | ||||
|           type: Utilization | ||||
|           averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} | ||||
|     {{- end }} | ||||
|     {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||||
|     - type: Resource | ||||
|       resource: | ||||
|         name: memory | ||||
|         target: | ||||
|           type: Utilization | ||||
|           averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||||
|     {{- end }} | ||||
| {{- end }} | ||||
							
								
								
									
										61
									
								
								.gitea/charts/templates/ingress.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								.gitea/charts/templates/ingress.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,61 @@ | ||||
| {{- if .Values.ingress.enabled -}} | ||||
| {{- $fullName := include "homeland.fullname" . -}} | ||||
| {{- $svcPort := .Values.service.port -}} | ||||
| {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} | ||||
|   {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} | ||||
|   {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} | ||||
|   {{- end }} | ||||
| {{- end }} | ||||
| {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} | ||||
| apiVersion: networking.k8s.io/v1 | ||||
| {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} | ||||
| apiVersion: networking.k8s.io/v1beta1 | ||||
| {{- else -}} | ||||
| apiVersion: extensions/v1beta1 | ||||
| {{- end }} | ||||
| kind: Ingress | ||||
| metadata: | ||||
|   name: {{ $fullName }} | ||||
|   labels: | ||||
|     {{- include "homeland.labels" . | nindent 4 }} | ||||
|   {{- with .Values.ingress.annotations }} | ||||
|   annotations: | ||||
|     {{- toYaml . | nindent 4 }} | ||||
|   {{- end }} | ||||
| spec: | ||||
|   {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} | ||||
|   ingressClassName: {{ .Values.ingress.className }} | ||||
|   {{- end }} | ||||
|   {{- if .Values.ingress.tls }} | ||||
|   tls: | ||||
|     {{- range .Values.ingress.tls }} | ||||
|     - hosts: | ||||
|         {{- range .hosts }} | ||||
|         - {{ . | quote }} | ||||
|         {{- end }} | ||||
|       secretName: {{ .secretName }} | ||||
|     {{- end }} | ||||
|   {{- end }} | ||||
|   rules: | ||||
|     {{- range .Values.ingress.hosts }} | ||||
|     - host: {{ .host | quote }} | ||||
|       http: | ||||
|         paths: | ||||
|           {{- range .paths }} | ||||
|           - path: {{ .path }} | ||||
|             {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} | ||||
|             pathType: {{ .pathType }} | ||||
|             {{- end }} | ||||
|             backend: | ||||
|               {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} | ||||
|               service: | ||||
|                 name: {{ $fullName }} | ||||
|                 port: | ||||
|                   number: {{ $svcPort }} | ||||
|               {{- else }} | ||||
|               serviceName: {{ $fullName }} | ||||
|               servicePort: {{ $svcPort }} | ||||
|               {{- end }} | ||||
|           {{- end }} | ||||
|     {{- end }} | ||||
| {{- end }} | ||||
							
								
								
									
										15
									
								
								.gitea/charts/templates/service.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								.gitea/charts/templates/service.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| apiVersion: v1 | ||||
| kind: Service | ||||
| metadata: | ||||
|   name: {{ include "homeland.fullname" . }} | ||||
|   labels: | ||||
|     {{- include "homeland.labels" . | nindent 4 }} | ||||
| spec: | ||||
|   type: {{ .Values.service.type }} | ||||
|   ports: | ||||
|     - port: {{ .Values.service.port }} | ||||
|       targetPort: http | ||||
|       protocol: TCP | ||||
|       name: http | ||||
|   selector: | ||||
|     {{- include "homeland.selectorLabels" . | nindent 4 }} | ||||
							
								
								
									
										12
									
								
								.gitea/charts/templates/serviceaccount.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								.gitea/charts/templates/serviceaccount.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| {{- if .Values.serviceAccount.create -}} | ||||
| apiVersion: v1 | ||||
| kind: ServiceAccount | ||||
| metadata: | ||||
|   name: {{ include "homeland.serviceAccountName" . }} | ||||
|   labels: | ||||
|     {{- include "homeland.labels" . | nindent 4 }} | ||||
|   {{- with .Values.serviceAccount.annotations }} | ||||
|   annotations: | ||||
|     {{- toYaml . | nindent 4 }} | ||||
|   {{- end }} | ||||
| {{- end }} | ||||
							
								
								
									
										15
									
								
								.gitea/charts/templates/tests/test-connection.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								.gitea/charts/templates/tests/test-connection.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| apiVersion: v1 | ||||
| kind: Pod | ||||
| metadata: | ||||
|   name: "{{ include "homeland.fullname" . }}-test-connection" | ||||
|   labels: | ||||
|     {{- include "homeland.labels" . | nindent 4 }} | ||||
|   annotations: | ||||
|     "helm.sh/hook": test | ||||
| spec: | ||||
|   containers: | ||||
|     - name: wget | ||||
|       image: busybox | ||||
|       command: ['wget'] | ||||
|       args: ['{{ include "homeland.fullname" . }}:{{ .Values.service.port }}'] | ||||
|   restartPolicy: Never | ||||
							
								
								
									
										84
									
								
								.gitea/charts/values.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								.gitea/charts/values.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,84 @@ | ||||
| # Default values for homeland. | ||||
| # This is a YAML-formatted file. | ||||
| # Declare variables to be passed into your templates. | ||||
| 
 | ||||
| replicaCount: 1 | ||||
| 
 | ||||
| image: | ||||
|   repository: 172.16.54.94:5000/homeland | ||||
|   pullPolicy: IfNotPresent | ||||
|   # Overrides the image tag whose default is the chart appVersion. | ||||
|   tag: "29" | ||||
| 
 | ||||
| imagePullSecrets: [] | ||||
| nameOverride: "" | ||||
| fullnameOverride: "" | ||||
| 
 | ||||
| serviceAccount: | ||||
|   # Specifies whether a service account should be created | ||||
|   create: true | ||||
|   # Annotations to add to the service account | ||||
|   annotations: {} | ||||
|   # The name of the service account to use. | ||||
|   # If not set and create is true, a name is generated using the fullname template | ||||
|   name: "" | ||||
| 
 | ||||
| podAnnotations: {} | ||||
| 
 | ||||
| podSecurityContext: {} | ||||
|   # fsGroup: 2000 | ||||
| 
 | ||||
| securityContext: {} | ||||
|   # capabilities: | ||||
|   #   drop: | ||||
|   #   - ALL | ||||
|   # readOnlyRootFilesystem: true | ||||
|   # runAsNonRoot: true | ||||
|   # runAsUser: 1000 | ||||
| 
 | ||||
| service: | ||||
|   type: ClusterIP | ||||
|   port: 80 | ||||
| 
 | ||||
| ingress: | ||||
|   enabled: false | ||||
|   className: "" | ||||
|   annotations: {} | ||||
|     # kubernetes.io/ingress.class: nginx | ||||
|     # kubernetes.io/tls-acme: "true" | ||||
|   hosts: | ||||
|     - host: homeland.local | ||||
|       paths: | ||||
|         - path: / | ||||
|           pathType: ImplementationSpecific | ||||
|   tls: [] | ||||
|   #  - secretName: chart-example-tls | ||||
|   #    hosts: | ||||
|   #      - chart-example.local | ||||
| 
 | ||||
| resources: {} | ||||
|   # We usually recommend not to specify default resources and to leave this as a conscious | ||||
|   # choice for the user. This also increases chances charts run on environments with little | ||||
|   # resources, such as Minikube. If you do want to specify resources, uncomment the following | ||||
|   # lines, adjust them as necessary, and remove the curly braces after 'resources:'. | ||||
|   # limits: | ||||
|   #   cpu: 100m | ||||
|   #   memory: 128Mi | ||||
|   # requests: | ||||
|   #   cpu: 100m | ||||
|   #   memory: 128Mi | ||||
| 
 | ||||
| autoscaling: | ||||
|   enabled: false | ||||
|   minReplicas: 1 | ||||
|   maxReplicas: 100 | ||||
|   targetCPUUtilizationPercentage: 80 | ||||
|   # targetMemoryUtilizationPercentage: 80 | ||||
| 
 | ||||
| nodeSelector: { | ||||
|   kubernetes.io/hostname: devsvr1 | ||||
| } | ||||
| 
 | ||||
| tolerations: [] | ||||
| 
 | ||||
| affinity: {} | ||||
| @ -3,7 +3,7 @@ run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - 'prod' | ||||
|       - 'prod-yantu' | ||||
| 
 | ||||
| env: | ||||
|   BUILD: staging | ||||
| @ -11,7 +11,7 @@ env: | ||||
| 
 | ||||
| jobs: | ||||
|   Explore-Gitea-Actions: | ||||
|     runs-on: stream9 | ||||
|     runs-on: yantoo-ci | ||||
|     steps: | ||||
|       - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." | ||||
|       - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" | ||||
| @ -26,19 +26,17 @@ jobs: | ||||
|           uname -a | ||||
|           pwd | ||||
|           ls ${{ gitea.workspace }} | ||||
|           cd ${{ gitea.workspace }} | ||||
|       - name: Build and push | ||||
|         uses: https://gitea.yantootech.com/neil/build-push-action@v6 | ||||
|         with: | ||||
|           push: false | ||||
|           tags: gong-zheng-html:${{ gitea.run_id }} | ||||
|       - name: Run docker | ||||
|           push: true | ||||
|           tags: 14.103.114.237:30005/gongzheng-app:${{ gitea.run_id }} | ||||
|       - name: Install | ||||
|         run: | | ||||
|           pwd | ||||
|           if [ "$(docker ps -q -f name=^gong-zheng-html$)" ]; then | ||||
|             docker stop gong-zheng-html | ||||
|           fi | ||||
|           docker run -d --rm --name gong-zheng-html \ | ||||
|             -v /usr/share/fonts/opentype/noto:/usr/share/fonts \ | ||||
|             -p 6216:80 \ | ||||
|             gong-zheng-html:${{ gitea.run_id }} | ||||
|           helm upgrade --install gongzheng-app ./.gitea/charts \ | ||||
|             --namespace gongzheng \ | ||||
|             --create-namespace \ | ||||
|             --set image.repository=14.103.114.237:30005/gongzheng-app \ | ||||
|             --set image.tag=${{ gitea.run_id }} | ||||
|       - run: echo "🍏 This job's status is ${{ job.status }}." | ||||
							
								
								
									
										168
									
								
								simple.html
									
									
									
									
									
								
							
							
						
						
									
										168
									
								
								simple.html
									
									
									
									
									
								
							| @ -145,7 +145,7 @@ | ||||
| 
 | ||||
|     .statement { | ||||
|             position: absolute; | ||||
|             bottom: 160px; | ||||
|             top: 42%; | ||||
|             left: 80%; | ||||
|             transform: translate(-50%); | ||||
|             color: #fff; | ||||
| @ -164,9 +164,9 @@ | ||||
| 
 | ||||
|         .subtitle { | ||||
|             position: absolute; | ||||
|             bottom: 40%; | ||||
|             left: 50%; | ||||
|             transform: translate(-50%); | ||||
|             top: 50%; | ||||
|             left: 40%; | ||||
|             transform: translateX(-50%); | ||||
|             color: #000; | ||||
|             padding: 12px; | ||||
|             box-sizing: border-box; | ||||
| @ -181,6 +181,80 @@ | ||||
|             display: none; | ||||
|         } | ||||
| 
 | ||||
|         /* 图片框样式 */ | ||||
|         .image-panel { | ||||
|             position: absolute; | ||||
|             top: 70%; | ||||
|             left: 6%; | ||||
|             transform: translateY(-50%); | ||||
|             display: none; | ||||
|             flex-direction: column; | ||||
|             gap: 20px; | ||||
|             z-index: 100000; | ||||
|         } | ||||
|          | ||||
|         .image-container-square { | ||||
|             width: 16vw; | ||||
|             height: 16vw; | ||||
|             border-radius: 8px; | ||||
|             overflow: hidden; | ||||
|             /* background: rgba(255, 255, 255, 0.1); */ | ||||
|             display: flex; | ||||
|             align-items: center; | ||||
|             justify-content: center; | ||||
|         } | ||||
|          | ||||
|         .image-container-vertical { | ||||
|             width: 64vw; | ||||
|             height: 78vw; | ||||
|             border-radius: 8px; | ||||
|             overflow: hidden; | ||||
|             /* background: rgba(255, 255, 255, 0.1); */ | ||||
|             display: flex; | ||||
|             align-items: center; | ||||
|             justify-content: center; | ||||
|         } | ||||
|          | ||||
|         .image-container-square img, | ||||
|         .image-container-vertical img { | ||||
|             width: 100%; | ||||
|             height: 100%; | ||||
|             object-fit: cover; | ||||
|         } | ||||
|          | ||||
|         .image-placeholder { | ||||
|             color: rgba(255, 255, 255, 0.7); | ||||
|             font-size: 14px; | ||||
|             text-align: center; | ||||
|         } | ||||
| 
 | ||||
|         .icon-btn { | ||||
|   background: rgba(255,255,255,0.7); | ||||
|   border: none; | ||||
|   border-radius: 50%; | ||||
|   width: 44px; | ||||
|   height: 44px; | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   justify-content: center; | ||||
|   position: fixed; | ||||
|   top: 20px; | ||||
|   left: 20px; | ||||
|   z-index: 100001; | ||||
|   cursor: pointer; | ||||
|   transition: background 0.2s; | ||||
|   box-shadow: 0 2px 8px rgba(0,0,0,0.08); | ||||
|   padding: 0; | ||||
| } | ||||
| .icon-btn + .icon-btn { | ||||
|   left: 74px; | ||||
| } | ||||
| .icon-btn:hover { | ||||
|   background: #eee; | ||||
| } | ||||
| .icon-btn img { | ||||
|   pointer-events: none; | ||||
| } | ||||
|          | ||||
|   </style> | ||||
|   <script src="https://cdn.bootcss.com/eruda/1.3.2/eruda.min.js"></script> | ||||
| @ -193,9 +267,28 @@ | ||||
| 
 | ||||
| <body> | ||||
|   <!-- 数字人容器 --> | ||||
|   <div class="container"></div> | ||||
|   <div class="container"> | ||||
|     <!-- 图片框 --> | ||||
|     <div class="image-panel"> | ||||
|       <div class="image-container-square"> | ||||
|         <img src="./yantu/erweima.jpg" alt="图片1"> | ||||
|       </div> | ||||
|       <div class="image-container-vertical"> | ||||
|         <img src="./yantu/wenzi2.png" alt="图片2"> | ||||
|       </div> | ||||
|     </div> | ||||
|   </div> | ||||
|   <div class="statement"></div> | ||||
|   <div class="subtitle"></div> | ||||
|    | ||||
|   <!-- 全屏图标按钮 --> | ||||
|   <button id="fullscreenBtn" class="icon-btn" title="全屏"> | ||||
|     <img src="./yantu/quanping.svg" alt="全屏" width="28" height="28"> | ||||
|   </button> | ||||
| <!-- 退出全屏图标按钮 --> | ||||
| <button id="exitFullscreenBtn" class="icon-btn" title="退出全屏" style="display: none;"> | ||||
|   <img src="./yantu/out_quan.svg" alt="退出全屏" width="28" height="28"> | ||||
| </button> | ||||
|   <!-- <input class="input" style="display: block;border-color: #8f1e00;z-index: 999;" id="duihua" placeholder="输入对话" value=""> --> | ||||
| 
 | ||||
|   <div id="modal" class="modal"> | ||||
| @ -211,8 +304,8 @@ | ||||
|           <option value="female" >女</option> | ||||
|         </select> | ||||
|         <select class="input" id="answer_type" style="margin-bottom: 16px;"> | ||||
|           <option value="jiguang" selected>极光</option> | ||||
|           <option value="gongzheng">公证</option> | ||||
|           <option value="jiguang">极光</option> | ||||
|           <option value="gongzheng" selected>公证</option> | ||||
|         </select> | ||||
|         <div style="display: none;margin-bottom: 8px; width: 100%; text-align: left; color: var(--text-200);">会话ID</div> | ||||
|         <input class="input" id="conversationId" style="display: none;" placeholder="请输入会话ID" value="1920410565458886658" title="请输入会话ID" /> | ||||
| @ -223,6 +316,39 @@ | ||||
|     </div> | ||||
|   </div> | ||||
|   <script> | ||||
|     // 全屏 | ||||
|     document.getElementById('fullscreenBtn').onclick = function() { | ||||
|       if (document.documentElement.requestFullscreen) { | ||||
|         document.documentElement.requestFullscreen(); | ||||
|       } else if (document.documentElement.webkitRequestFullscreen) { // Safari | ||||
|         document.documentElement.webkitRequestFullscreen(); | ||||
|       } else if (document.documentElement.msRequestFullscreen) { // IE11 | ||||
|         document.documentElement.msRequestFullscreen(); | ||||
|       } | ||||
|     }; | ||||
| 
 | ||||
|     // 退出全屏 | ||||
|     document.getElementById('exitFullscreenBtn').onclick = function() { | ||||
|       if (document.exitFullscreen) { | ||||
|         document.exitFullscreen(); | ||||
|       } else if (document.webkitExitFullscreen) { // Safari | ||||
|         document.webkitExitFullscreen(); | ||||
|       } else if (document.msExitFullscreen) { // IE11 | ||||
|         document.msExitFullscreen(); | ||||
|       } | ||||
|     }; | ||||
| 
 | ||||
|     // 监听全屏状态变化,切换按钮显示 | ||||
|     document.addEventListener('fullscreenchange', function() { | ||||
|       if (document.fullscreenElement) { | ||||
|         document.getElementById('fullscreenBtn').style.display = 'none'; | ||||
|         document.getElementById('exitFullscreenBtn').style.display = 'inline-block'; | ||||
|       } else { | ||||
|         document.getElementById('fullscreenBtn').style.display = 'inline-block'; | ||||
|         document.getElementById('exitFullscreenBtn').style.display = 'none'; | ||||
|       } | ||||
|     }); | ||||
| 
 | ||||
|     const duix = new DUIX() | ||||
| 
 | ||||
|     const sex = { | ||||
| @ -257,7 +383,7 @@ | ||||
| 
 | ||||
|     async function getToken() { | ||||
|       try { | ||||
|         const response = await fetch('https://srtc.yantootech.com/token', { | ||||
|         const response = await fetch('https://14.103.114.237/gongzheng-backend/token', { | ||||
|           method: 'POST', | ||||
|           headers: { | ||||
|             'Content-Type': 'application/json', | ||||
| @ -319,6 +445,7 @@ | ||||
|         console.info('show') | ||||
|         // 此时可确认视频已 | ||||
|         document.querySelector('#modal').style.display = "none" | ||||
|         document.querySelector('.image-panel').style.display = "flex" | ||||
|         document.querySelector('.statement').style.visibility = "visible" | ||||
|         document.querySelector('.subtitle').style.visibility = "visible" | ||||
|       }) | ||||
| @ -336,21 +463,27 @@ | ||||
|       // }) | ||||
|       duix.on('speakSection', (data) => { | ||||
|         console.info('speakSection', data) | ||||
|         document.querySelector('.subtitle').innerText = data.content | ||||
|         document.querySelector('.image-panel').style.display = 'none' | ||||
|         document.querySelector('.subtitle').innerText = document.querySelector('.subtitle').innerText +  data.content | ||||
|         // document.querySelector('.statement').innerText = all_answer + data; | ||||
|       }) | ||||
|       duix.on('asrStop', (data) => { | ||||
|             console.info('asrStop', data)  | ||||
|             document.querySelector('.statement').innerText = data.content; | ||||
|             // document.querySelector('.subtitle').innerText = '' | ||||
|             // document.querySelector('.statement').innerText = '' | ||||
|         }); | ||||
|       duix.on('speakError', (data) => { | ||||
|         console.info('speakError', data) | ||||
|       }) | ||||
|       duix.on('asrResult', async (data) => { | ||||
|         document.querySelector('.statement').innerText = '' | ||||
|         document.querySelector('.subtitle').innerText = '' | ||||
|         // document.querySelector('.statement').innerText = '' | ||||
|         // document.querySelector('.subtitle').innerText = '' | ||||
|         document.querySelector('.statement').innerText = data; | ||||
|          | ||||
|          | ||||
|         console.info('asrResult', data, trigger_status); | ||||
|         if (data == "小公" || data == "小共" || data == "小工"){ | ||||
|          | ||||
|         if (data.includes("暂停说话") || data.includes("暂停播放")){ | ||||
|           duix.break() | ||||
|           trigger_status = true | ||||
|           return | ||||
| @ -359,8 +492,10 @@ | ||||
|          | ||||
|         if (trigger_status) { | ||||
|           try { | ||||
|             document.querySelector('.subtitle').innerText = '' | ||||
|             document.querySelector('.image-panel').style.display = 'flex' | ||||
|             // document.querySelector('.statement').innerText = '' | ||||
|             trigger_status = false; | ||||
|              | ||||
| 
 | ||||
|             let plu = document.getElementById('answer_type') | ||||
|             api_data = {} | ||||
| @ -394,7 +529,7 @@ | ||||
|                 } | ||||
|                | ||||
|             } | ||||
|             const response = await fetch('https://srtc.yantootech.com/chat', { | ||||
|             const response = await fetch('https://14.103.114.237/gongzheng-backend/chat', { | ||||
|                 method: 'POST', | ||||
|                 headers: { | ||||
|                   'Content-Type': 'application/json', | ||||
| @ -462,6 +597,9 @@ | ||||
| 
 | ||||
|         if(end_talk == data["content"]){ | ||||
|           trigger_status = true | ||||
|           document.querySelector('.image-panel').style.display = 'flex' | ||||
|           document.querySelector('.subtitle').innerText = '' | ||||
|           document.querySelector('.statement').innerText = '' | ||||
|         } | ||||
| 
 | ||||
|       }) | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								yantu/erweima.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								yantu/erweima.jpg
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 46 KiB | 
							
								
								
									
										1
									
								
								yantu/out_quan.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								yantu/out_quan.svg
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750851117505" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6046" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M257.706667 376.32H128c-11.946667 0-21.333333-9.386667-21.333333-21.333333s9.386667-21.333333 21.333333-21.333334h129.706667c35.413333 0 64-28.586667 64-64V128c0-11.946667 9.386667-21.333333 21.333333-21.333333s21.333333 9.386667 21.333333 21.333333v141.653333a106.666667 106.666667 0 0 1-106.666666 106.666667zM896 376.32h-129.706667a106.666667 106.666667 0 0 1-106.666666-106.666667V128c0-11.946667 9.386667-21.333333 21.333333-21.333333s21.333333 9.386667 21.333333 21.333333v141.653333c0 35.413333 28.586667 64 64 64H896c11.946667 0 21.333333 9.386667 21.333333 21.333334s-9.386667 21.333333-21.333333 21.333333z" fill="#666666" p-id="6047"></path><path d="M896 376.32h-129.706667a106.666667 106.666667 0 0 1-106.666666-106.666667V128c0-11.946667 9.386667-21.333333 21.333333-21.333333s21.333333 9.386667 21.333333 21.333333v141.653333c0 35.413333 28.586667 64 64 64H896c11.946667 0 21.333333 9.386667 21.333333 21.333334s-9.386667 21.333333-21.333333 21.333333zM257.706667 376.32H128c-11.946667 0-21.333333-9.386667-21.333333-21.333333s9.386667-21.333333 21.333333-21.333334h129.706667c35.413333 0 64-28.586667 64-64V128c0-11.946667 9.386667-21.333333 21.333333-21.333333s21.333333 9.386667 21.333333 21.333333v141.653333a106.666667 106.666667 0 0 1-106.666666 106.666667zM680.96 917.333333c-11.946667 0-21.333333-9.386667-21.333333-21.333333v-141.653333a106.666667 106.666667 0 0 1 106.666666-106.666667H896c11.946667 0 21.333333 9.386667 21.333333 21.333333s-9.386667 21.333333-21.333333 21.333334h-129.706667c-35.413333 0-64 28.586667-64 64V896c0 11.946667-9.386667 21.333333-21.333333 21.333333zM343.04 917.333333c-11.946667 0-21.333333-9.386667-21.333333-21.333333v-141.653333c0-35.413333-28.586667-64-64-64H128c-11.946667 0-21.333333-9.386667-21.333333-21.333334s9.386667-21.333333 21.333333-21.333333h129.706667a106.666667 106.666667 0 0 1 106.666666 106.666667V896c0 11.946667-9.813333 21.333333-21.333333 21.333333z" fill="#666666" p-id="6048"></path><path d="M343.04 917.333333c-11.946667 0-21.333333-9.386667-21.333333-21.333333v-141.653333c0-35.413333-28.586667-64-64-64H128c-11.946667 0-21.333333-9.386667-21.333333-21.333334s9.386667-21.333333 21.333333-21.333333h129.706667a106.666667 106.666667 0 0 1 106.666666 106.666667V896c0 11.946667-9.813333 21.333333-21.333333 21.333333zM680.96 917.333333c-11.946667 0-21.333333-9.386667-21.333333-21.333333v-141.653333a106.666667 106.666667 0 0 1 106.666666-106.666667H896c11.946667 0 21.333333 9.386667 21.333333 21.333333s-9.386667 21.333333-21.333333 21.333334h-129.706667c-35.413333 0-64 28.586667-64 64V896c0 11.946667-9.386667 21.333333-21.333333 21.333333z" fill="#666666" p-id="6049"></path></svg> | ||||
| After Width: | Height: | Size: 2.9 KiB | 
							
								
								
									
										1
									
								
								yantu/quanping.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								yantu/quanping.svg
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750851037916" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5070" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M145.066667 85.333333h153.6c25.6 0 42.666667-17.066667 42.666666-42.666666S324.266667 0 298.666667 0H34.133333C25.6 0 17.066667 8.533333 8.533333 17.066667 0 25.6 0 34.133333 0 42.666667v256c0 25.6 17.066667 42.666667 42.666667 42.666666s42.666667-17.066667 42.666666-42.666666V145.066667l230.4 230.4c17.066667 17.066667 42.666667 17.066667 59.733334 0 17.066667-17.066667 17.066667-42.666667 0-59.733334L145.066667 85.333333z m170.666666 563.2L162.133333 802.133333l-76.8 76.8V725.333333C85.333333 699.733333 68.266667 682.666667 42.666667 682.666667s-42.666667 17.066667-42.666667 42.666666v256c0 25.6 17.066667 42.666667 42.666667 42.666667h256c25.6 0 42.666667-17.066667 42.666666-42.666667s-17.066667-42.666667-42.666666-42.666666H145.066667l76.8-76.8 153.6-153.6c17.066667-17.066667 17.066667-42.666667 0-59.733334-17.066667-17.066667-42.666667-17.066667-59.733334 0z m665.6 34.133334c-25.6 0-42.666667 17.066667-42.666666 42.666666v153.6l-76.8-76.8-153.6-153.6c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733334l153.6 153.6 76.8 76.8H725.333333c-25.6 0-42.666667 17.066667-42.666666 42.666666s17.066667 42.666667 42.666666 42.666667h256c25.6 0 42.666667-17.066667 42.666667-42.666667v-256c0-25.6-17.066667-42.666667-42.666667-42.666666z m0-682.666667h-256c-25.6 0-42.666667 17.066667-42.666666 42.666667s17.066667 42.666667 42.666666 42.666666h153.6l-76.8 76.8-153.6 153.6c-17.066667 17.066667-17.066667 42.666667 0 59.733334 17.066667 17.066667 42.666667 17.066667 59.733334 0l153.6-153.6 76.8-76.8v153.6c0 25.6 17.066667 42.666667 42.666666 42.666666s42.666667-17.066667 42.666667-42.666666v-256c0-25.6-17.066667-42.666667-42.666667-42.666667z" fill="" p-id="5071"></path></svg> | ||||
| After Width: | Height: | Size: 2.0 KiB | 
							
								
								
									
										
											BIN
										
									
								
								yantu/wenzi2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								yantu/wenzi2.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 177 KiB | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user