欢迎来到万相科技官网!
全国咨询热线: 18052587333
seobg
当前位置:主页 > 常见问题 >
不标榜自己,我们的价值取决于您

我们致力企业提供一站式全网营销方案

今天教大家怎么白嫖ChatGPT,零基础小白10秒搭建完成

文章出处: 万相科技    人气:833    发表时间:2024-01-09 21:57:40

ChatGPTOpenAI使

AI访http://ai.sc9.cn使使10使

Html

<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script><script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<div id="app" style="display: flex;flex-flow: column;margin: 20 ">    <scroll-view scroll-with-animation scroll-y="true" style="width: 100%;">        <!--  -->        <view id="okk" scroll-with-animation>            <!--  -->            <view v-for="(x,i) in msgList" :key="i">                <!--  -->                <view v-if="x.my" style="display: flex;                flex-direction: column;                align-items: flex-end;">
                    <view style="width: 400rpx;">                        <view style="border-radius: 35rpx;">                            <text style="word-break: break-all;">{{x.msg}}</text>                        </view>                    </view>
                </view>                <!--  -->                <view v-if="!x.my" style="display: flex;                flex-direction: row;                align-items: flex-start;">
                    <view style="width: 500rpx;">                        <view style="border-radius: 35rpx;background-color: #f9f9f9;">                            <text style="word-break: break-all;">{{x.msg}}</text>                        </view>                    </view>                </view>            </view>

            <view style="height: 130rpx;">
            </view>        </view>
    </scroll-view>
    <!--  -->    <view style="position: fixed;bottom:0px;width: 100%;display: flex;    flex-direction: column;    justify-content: center;    align-items: center;">    <view style="font-size: 55rpx;display: flex;        flex-direction: row;        justify-content: space-around;        align-items: center;width: 75%;    margin: 0;"><input @blur='entapi' required v-model="api" type="text" style="width: 75%;            height: 45px;            border-radius: 50px;            padding-left: 20px;            margin-left: 10px;background-color: #f0f0f0;" @confirm="sendMsg" confirm-type="search"                placeholder-class="my-neirong-sm" placeholder="apikey :sk-s5S5BoV... "  /></view>        <view style="font-size: 55rpx;display: flex;        flex-direction: row;        justify-content: space-around;        align-items: center;width: 75%;    margin: 20;">
            <input v-on:keyup.enter="sendMsg"  v-model="msg" type="text" style="width: 75%;            height: 45px;            border-radius: 50px;            padding-left: 20px;            margin-left: 10px;background-color: #f0f0f0;" @confirm="sendMsg" confirm-type="search"                placeholder-class="my-neirong-sm" placeholder="," />            <button @click="sendMsg" :disabled="msgLoad" style="height: 45px;            width: 20%;;    color: #030303;    border-radius: 2500px;" >{{sentext}}</button>        </view>    </view>    </view></div><script>    const { createApp } = Vue    createApp({        data() {            return {                api: '',                msgLoad: false,                anData: {},                sentext: 'api',
                animationData: {},                showTow: false,                msgList: [{                    my: false,                    msg: "openAI,?"                }],                msgContent: "",                msg: ""            }        },        methods: {              entapi(){        console.log('11');        this.sentext = 'api'        axios.post('https://api.openai.com/v1/completions', {            prompt: '', max_tokens: 2048, model: "text-davinci-003"        }, {            headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + this.api }        }).then(res => {          console.log('suss',res);          this.msgLoad = false          this.sentext = ''                            }).catch(error =>{          console.log('error',error);          console.log(error.code);          if(error.code == 'ERR_BAD_REQUEST'){            this.sentext = 'apikey'            this.msgLoad = true                        return 0;          }                          })      },            sendMsg() {
                //                 if (this.msg == "") {                    return 0;                }        if (this.api == ""){          this.sentext = 'apikey'          return 0;        }                this.sentext = ''                this.msgList.push({                    "msg": this.msg,                    "my": true                })                console.log(this.msg);                this.msgContent += ('YOU:' + this.msg + "n")                this.msgLoad = true                //                 this.msg = ""                axios.post('https://api.openai.com/v1/completions', {                    prompt: this.msgContent, max_tokens: 2048, model: "text-davinci-003"                }, {                    headers: { 'content-type': 'application/json', 'Authorization': 'Bearer ' + this.api }                }).then(res => {                    console.log(res);                    let text = res.data.choices[0].text.replace("openai:", "").replace("openai", "").replace(/^n|n$/g, "")                    console.log(text);                    this.msgList.push({                        "msg": text,                        "my": false                    })                    this.msgContent += (text + "n")                    this.msgLoad = false                    this.sentext = ''                }).catch(error =>{          console.log('error',error);          console.log(error.code);          this.sentext = ','          this.msgLoad = false                                              })
            },

        }    }).mount('#app')</script>

使

1TXTxxx.html

2apikey

3OpenAI

 1apikeyapikey使1000

 2ChatGPTapi1-5

 3OpenAIapiapikey使

      


标签:
  • chatpgt
  • ai
  • openai
  • 文章来源:万相科技,欢迎分享,转载请保留出处
    原文地址:https://www.sc9.cn/news/cjwt/21297.html
    没有了!
    没有了!

    猜你喜欢