github.com/kubevela/workflow@v0.6.0/examples/workflow-run/chat-gpt.yaml (about)

     1  apiVersion: core.oam.dev/v1alpha1
     2  kind: WorkflowRun
     3  metadata:
     4    name: chat-gpt
     5    namespace: default
     6  spec:
     7    workflowSpec:
     8      steps:
     9      # apply a deployment with invalid image, this step will fail because of timeout
    10      # the resource will be passed to chat-gpt step to anaylze
    11      - name: apply
    12        type: apply-deployment
    13        timeout: 3s
    14        outputs:
    15          - name: resource
    16            valueFrom: output.value
    17        properties:
    18          image: invalid
    19  
    20      # if apply step failed, send the resource to chat-gpt to diagnose
    21      - name: chat-diagnose
    22        if: status.apply.failed
    23        type: chat-gpt
    24        inputs:
    25          - from: resource
    26            parameterKey: prompt.content
    27        properties:
    28          token: 
    29            # specify your token
    30            value: <your token>
    31          prompt:
    32            type: diagnose
    33  
    34      # if apply step succeeded, send the resource to chat-gpt to audit
    35      - name: chat-audit
    36        if: status.apply.succeeded
    37        type: chat-gpt
    38        inputs:
    39          - from: resource
    40            parameterKey: prompt.content
    41        properties:
    42          token: 
    43            # or read your token from secret
    44            secretRef:
    45              name: chat-gpt-token-secret
    46              key: token
    47          prompt:
    48            type: audit
    49            lang: Chinese