apiVersion: app.sealos.io/v1
kind: Instance
metadata:
  name: gpt-academic-ficjzxjm
  labels:
    cloud.sealos.io/deploy-on-sealos: gpt-academic-ficjzxjm
spec:
  gitRepo: https://github.com/binary-husky/gpt_academic
  templateType: inline
  categories:
    - ai
  defaults:
    app_host:
      type: string
      value: iftrmfjq
    app_name:
      type: string
      value: gpt-academic-ficjzxjm
  inputs:
    API_KEY:
      description: 可同时填写多个 API-KEY，用英文逗号分割
      type: string
      default: ''
      required: true
    API_URL_REDIRECT:
      description: 重新URL重新定向，实现更换API_URL的作用
      type: string
      default: ''
      required: false
    LLM_MODEL:
      description: 模型选择
      type: string
      default: gpt-3.5-turbo
      required: false
    AVAIL_LLM_MODELS:
      description: 所有可用模型
      type: string
      default: >-
        ["gpt-3.5-turbo", "api2d-gpt-3.5-turbo", "gpt-4", "api2d-gpt-4",
        "sparkv2", "qianfan"]
      required: false
    ADD_WAIFU:
      description: 加一个 live2d 看板娘装饰
      type: string
      default: 'True'
      required: false
  title: gpt-academic
  url: https://github.com/binary-husky/gpt_academic
  author: Sealos
  description: GPT Academic Optimization
  readme: https://cdn.jsdelivr.net/gh/binary-husky/gpt_academic@master/README.md
  icon: https://cdn.jsdelivr.net/gh/binary-husky/gpt_academic@master/docs/logo.png
  deployCount: 1

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gpt-academic-ficjzxjm
  annotations:
    originImageName: ghcr.io/binary-husky/gpt_academic_nolocal:master
    deploy.cloud.sealos.io/minReplicas: '1'
    deploy.cloud.sealos.io/maxReplicas: '1'
  labels:
    cloud.sealos.io/app-deploy-manager: gpt-academic-ficjzxjm
    app: gpt-academic-ficjzxjm
    cloud.sealos.io/deploy-on-sealos: gpt-academic-ficjzxjm
spec:
  replicas: 1
  revisionHistoryLimit: 1
  selector:
    matchLabels:
      app: gpt-academic-ficjzxjm
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 0
  template:
    metadata:
      labels:
        app: gpt-academic-ficjzxjm
    spec:
      automountServiceAccountToken: false
      containers:
        - name: gpt-academic-ficjzxjm
          image: ghcr.io/binary-husky/gpt_academic_nolocal:master
          env:
            - name: API_KEY
              value: null
            - name: API_URL_REDIRECT
              value: null
            - name: LLM_MODEL
              value: gpt-3.5-turbo
            - name: AVAIL_LLM_MODELS
              value: >-
                ["gpt-3.5-turbo","api2d-gpt-3.5-turbo","gpt-4","api2d-gpt-4","sparkv2","qianfan"]
            - name: WEB_PORT
              value: '22303'
            - name: ADD_WAIFU
              value: 'true'
          resources:
            requests:
              cpu: 100m
              memory: 102Mi
            limits:
              cpu: 1000m
              memory: 1024Mi
          command: []
          args: []
          ports:
            - containerPort: 22303
          imagePullPolicy: Always
          volumeMounts: []
      volumes: []

---
apiVersion: v1
kind: Service
metadata:
  name: gpt-academic-ficjzxjm
  labels:
    cloud.sealos.io/app-deploy-manager: gpt-academic-ficjzxjm
    cloud.sealos.io/deploy-on-sealos: gpt-academic-ficjzxjm
spec:
  ports:
    - port: 22303
  selector:
    app: gpt-academic-ficjzxjm

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: gpt-academic-ficjzxjm
  labels:
    cloud.sealos.io/app-deploy-manager: gpt-academic-ficjzxjm
    cloud.sealos.io/app-deploy-manager-domain: iftrmfjq
    cloud.sealos.io/deploy-on-sealos: gpt-academic-ficjzxjm
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: 32m
    nginx.ingress.kubernetes.io/server-snippet: |
      client_header_buffer_size 64k;
      large_client_header_buffers 4 128k;
    nginx.ingress.kubernetes.io/ssl-redirect: 'false'
    nginx.ingress.kubernetes.io/backend-protocol: HTTP
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/client-body-buffer-size: 64k
    nginx.ingress.kubernetes.io/proxy-buffer-size: 64k
    nginx.ingress.kubernetes.io/proxy-send-timeout: '300'
    nginx.ingress.kubernetes.io/proxy-read-timeout: '300'
    nginx.ingress.kubernetes.io/configuration-snippet: |
      if ($request_uri ~* \.(js|css|gif|jpe?g|png)) {
        expires 30d;
        add_header Cache-Control "public";
      }
spec:
  rules:
    - host: iftrmfjq.sealoshzh.site
      http:
        paths:
          - pathType: Prefix
            path: /()(.*)
            backend:
              service:
                name: gpt-academic-ficjzxjm
                port:
                  number: 22303
  tls:
    - hosts:
        - iftrmfjq.sealoshzh.site
      secretName: wildcard-cert
