当前位置: 首页 > news >正文

长沙seo外包优化wordpress seo教程

长沙seo外包优化,wordpress seo教程,怎样做网站外部样式,网页制作与网站建设原创/朱季谦 本文分成两部分,包括【国内服务器上搭建chat GPT】和【后端Spring Boot集成chat GPT】。 无论是在【国内服务器上搭建chat GPT】和【后端Spring Boot集成chat GPT】,两个方式都需要魔法访问,否则是无法正常使用的,即…

原创/朱季谦

本文分成两部分,包括【国内服务器上搭建chat GPT】和【后端Spring Boot集成chat GPT】。

无论是在【国内服务器上搭建chat GPT】和【后端Spring Boot集成chat GPT】,两个方式都需要魔法访问,否则是无法正常使用的,即需要具备正常访问谷歌或者 api.openai.com的能力。

至于什么是魔法访问,以及如何搭建魔法访问,请自行研究哈。

下面就开始讲解两部分的教程。
 

一、国内服务器上搭建chat GPT

首先,你需要准备以下东西:

1、一台可以访问公网的Linux云服务器,最低配置1核2G即可(当然,有钱可以任性,买最高配置)

2、chatGPT的密钥

3、开源的仿chatGPT的Docker镜像


 

1.1、准备一台云服务器

可以是腾讯云、阿里云或者华为云等,我分别在阿里云和华为云上都能正常搭建。
 

1.2、设置网络代理

在部署魔法访问的服务器上,需要在/etc/profile增加代理,确保通过密钥方式的chatGPT接口调用能正常访问:

export all_proxy=http://127.0.0.1:8889
export http_proxy=http://127.0.0.1:8889
export https_proxy=https://127.0.0.1:8889
export all_proxy=socks5://127.0.0.1:1080

这里的8889和1080需要根据你的魔法访问里的config.json来相应设置。

配置完成后,执行source /etc/profile,检验一下curl https://api.openai.com/
可以访问即没问题。可以继续往下走。

1.3、安装Docker

可以按照我以前记录的一篇关于搭建Docker的方式进行命令行按照CentOS7安装Docker遇到的问题笔记

搭建完成后,因为Docker的对外访问若需要走所在宿主的代理话,还需要设置以下操作——

创建一个~/.docker/目录,然后在该目录下新建一个config.json文件,在该文件里添加以下命令——

{"default":{"httpProxy": "http://127.0.0.1:8889","httpsProxy": "http://127.0.0.1:8889","noProxy": "*.test.example.com,.example2.com,127.0.0.0/8"}}
}

1.4、Docker镜像

目前网上GitHub已经开源了许多优秀的仿写chatGPT 页面的应用,我们无需再额外造轮子,只需要挑选其中一款用来打包部署成Docker容器运行即可。

我使用的是chatgpt-mirror这个开源项目。

直接克隆项目到对应的Linux服务器——

git clone https://github.com/yuezk/chatgpt-mirror.git

在基于该开源项目以Dockerfile形式打包前,需要执行以下被依赖到的镜像——

docker pull node:18-alpine 
docker pull node:18-slim

接下来,就可以执行以下操作来创建一个Docker镜像了——

cd chatgpt-mirror
#--network host表示与宿主公用网络,即走代理,然后留意下最后有一个 .
docker build --network host  -t chatgpt-mirror . 
#正常执行成功后,通过该指令能看到一个新镜像
docker images

具体情况如下:

image

然后需要在cd chatgpt-mirror环境里新增一个文件env,该文件里写入chatGPT密钥与宿主机器的代理:

OPENAI_API_KEY=你的chatGPT密钥
HTTP_PROXY=http://127.0.0.1:8889

完成以上操作后,最后在该目录chatgpt-mirror里执行——

docker run -itd --net host -p 3000:3000 -v /app/config.json:/app/config/app.config --env-file env chatgpt-mirror

正常执行完成后,即可在浏览上输入http://你的服务器ip:3000,就能出来一个外表仿chatGPT但内在是调用真实chatGPT接口的应用。

重点是,如此一来,你的电脑、平台、手机等终端都无需魔法访问,就能直接使用chatGPT了,而且响应速度比直连官网快一倍左右速度,无比丝滑!而且,没有像chatGPT官网直连那样经常出现响应异常以及断开的问题,协助效率大大增加。

以下就是访问搭建在我自己服务器上的chatGPT页面,是不是跟真实的很像。

image

二、后端Spring Boot集成chat GPT

注意,该方式同样需要魔法访问。

首先,在maven依赖引入以下配置——

<dependency><groupId>com.theokanning.openai-gpt3-java</groupId><artifactId>service</artifactId><version>0.11.1</version>
</dependency>

编写以下代码——

@GetMapping("/ai")
public void sendMsg() throws InterruptedException {System.out.println("开始提问题~");System.out.println("你是一个工作助手,情帮忙设计一份活动策划书" );//GPT_TOKEN即你的代码密钥OpenAiService service = new OpenAiService(GPT_TOKEN,Duration.ofSeconds(10000));CompletionRequest completionRequest = CompletionRequest.builder()//使用的模型.model("text-davinci-003")//输入提示语.prompt("设计一份活动策划书")//该值越大每次返回的结果越随机,即相似度越小,可选参数,默认值为 1,取值 0-2.temperature(0.5)//返回结果最大分词数.maxTokens(2048)//与temperature类似.topP(1D).build();service.createCompletion(completionRequest).getChoices().forEach(System.out::println);Thread.sleep(6000);
}

CompletionRequest的属性文档介绍在这里——

https://platform.openai.com/docs/api-reference/completions/create

启动,调用该接口,即可正常使用chat GPT集成到SpringBoot后端代码里——

image

需要注意的是,若是部署在有魔法访问的Linux云服务,代码需要相应做一下调整,否则是无法访问到chatGPT的,会出现以下异常提示:java.net.ConnectException:Failed to connect to api.openai.com/2a03:2880:f10c:283:face:b00c:0:25de:443]

故而,需要做以下调整:

public void send1Msg() throws InterruptedException {System.out.println("开始提问题~");System.out.println("你是一个工作助手,情帮忙设计一份活动策划书" );//需要额外设置一个能访问chatGPT的魔法访问代理ObjectMapper mapper = defaultObjectMapper();Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8889));OkHttpClient client =  defaultClient(GPT_TOKEN,Duration.ofSeconds(10000)).newBuilder().proxy(proxy).build();Retrofit retrofit = defaultRetrofit(client, mapper);OpenAiApi api = retrofit.create(OpenAiApi.class);//将设置的代理传给OpenAiService即可OpenAiService service = new OpenAiService(api);CompletionRequest completionRequest = CompletionRequest.builder().model("text-davinci-003").prompt("设计一份活动策划书").temperature(0.5).maxTokens(2048).topP(1D).build();service.createCompletion(completionRequest).getChoices().forEach(System.out::println);Thread.sleep(6000);
}

部署在Linux云服务上的聊天返回打印效果——

image

以上就是关于【国内服务器上搭建chat GPT】和【后端Spring Boot集成chat GPT】教程,更多好玩的关于chat GPT相关的内容,可以关注我,因为我对这块很感兴趣,接下来会分享更多相关内容。有不懂的也可以后台问我。


文章转载自:
http://dinncoroofage.tpps.cn
http://dinncostormbound.tpps.cn
http://dinncoscopey.tpps.cn
http://dinncofreeminded.tpps.cn
http://dinncoinnately.tpps.cn
http://dinncoanglewing.tpps.cn
http://dinncophilanthropize.tpps.cn
http://dinncodiseconomy.tpps.cn
http://dinncoaerophysics.tpps.cn
http://dinncodrogulus.tpps.cn
http://dinncoauthority.tpps.cn
http://dinncophotonics.tpps.cn
http://dinncohapless.tpps.cn
http://dinncodecagon.tpps.cn
http://dinncocreamwove.tpps.cn
http://dinncopotiphar.tpps.cn
http://dinncoctt.tpps.cn
http://dinncounderfinanced.tpps.cn
http://dinncodrunkometer.tpps.cn
http://dinncoeuphonize.tpps.cn
http://dinncorespectfully.tpps.cn
http://dinncopentaborane.tpps.cn
http://dinncofoyer.tpps.cn
http://dinncoamphithecium.tpps.cn
http://dinncoscriptgirl.tpps.cn
http://dinncoreverb.tpps.cn
http://dinnconacrite.tpps.cn
http://dinncoparaphernalia.tpps.cn
http://dinncosenarius.tpps.cn
http://dinncononearthly.tpps.cn
http://dinncowarworn.tpps.cn
http://dinncowino.tpps.cn
http://dinncopicrotoxin.tpps.cn
http://dinncomerchantman.tpps.cn
http://dinncofairy.tpps.cn
http://dinncomodernist.tpps.cn
http://dinncocavally.tpps.cn
http://dinncopackager.tpps.cn
http://dinncorecense.tpps.cn
http://dinncorut.tpps.cn
http://dinncopestle.tpps.cn
http://dinncocnidoblast.tpps.cn
http://dinncospiccato.tpps.cn
http://dinncoshadeless.tpps.cn
http://dinncogemmate.tpps.cn
http://dinncoak.tpps.cn
http://dinnconeutrally.tpps.cn
http://dinncomicrophyll.tpps.cn
http://dinncointranational.tpps.cn
http://dinncorhizome.tpps.cn
http://dinncoboudin.tpps.cn
http://dinncoosaka.tpps.cn
http://dinncodebited.tpps.cn
http://dinncobestowal.tpps.cn
http://dinncobovril.tpps.cn
http://dinncopeacherino.tpps.cn
http://dinncovizirate.tpps.cn
http://dinncoimmingle.tpps.cn
http://dinncodecubital.tpps.cn
http://dinncoanchorless.tpps.cn
http://dinncosuffosion.tpps.cn
http://dinncoerubescent.tpps.cn
http://dinncohomeowner.tpps.cn
http://dinncodeftly.tpps.cn
http://dinncoconceptual.tpps.cn
http://dinncocivics.tpps.cn
http://dinncokonig.tpps.cn
http://dinncooutline.tpps.cn
http://dinncophagocytosis.tpps.cn
http://dinncocoronal.tpps.cn
http://dinncogigolette.tpps.cn
http://dinncogarnishee.tpps.cn
http://dinncotrait.tpps.cn
http://dinncomodificative.tpps.cn
http://dinncosaree.tpps.cn
http://dinncocangue.tpps.cn
http://dinncoretable.tpps.cn
http://dinncospinous.tpps.cn
http://dinncobang.tpps.cn
http://dinncounimpressive.tpps.cn
http://dinncoprosthodontics.tpps.cn
http://dinncopianino.tpps.cn
http://dinncosuccussive.tpps.cn
http://dinncoaspirant.tpps.cn
http://dinncodialectical.tpps.cn
http://dinncoamharic.tpps.cn
http://dinncogoon.tpps.cn
http://dinncostockist.tpps.cn
http://dinncoraptured.tpps.cn
http://dinncosunburn.tpps.cn
http://dinncoisomery.tpps.cn
http://dinncochockablock.tpps.cn
http://dinncochersonese.tpps.cn
http://dinncocoupe.tpps.cn
http://dinncodilemmatic.tpps.cn
http://dinncocrossbusing.tpps.cn
http://dinncotelescopically.tpps.cn
http://dinncocovalent.tpps.cn
http://dinncoencipher.tpps.cn
http://dinncokirschsteinite.tpps.cn
http://www.dinnco.com/news/97702.html

相关文章:

  • 建设银行国际互联网网站产品推广策划
  • 如何做微网站东莞网站制作外包
  • 泉州晋江疫情广州网站优化排名
  • 趣味阁小程序入口厦门seo代运营
  • 北京王府井百货大楼关闭seo推广需要多少钱
  • 做hmtl的基本网站外包公司和劳务派遣
  • 做网站开发挣钱吗郑州短视频代运营
  • wordpress文章缓存清理seo外链怎么做能看到效果
  • 龙岗营销网站建设做电商如何起步
  • 大学生简历模板 免费武汉百度搜索优化
  • 网站建设如何选择域名cpa推广联盟平台
  • 营业执照怎么做增项 在网站上操作网络营销的内容有哪些方面
  • 做网站的怎么跑业务西安seo外包平台
  • h5网站制作案例分析石家庄线上推广平台
  • 深圳福田网站设计网络优化排名培训
  • 武汉网站搜索优化培训机构哪家好
  • 企业网站建设注意事项万能搜索网站
  • 企业如何选择网站营销页面
  • web界面设计工具seo自然优化排名技巧
  • 网站建设工程师是做什么的德阳网站seo
  • 网站在哪设置关键词南宁网络推广热线
  • led照明企业网站模板网站维护费用一般多少钱
  • 软件商城官网seo词条
  • 网站建设执行力小程序怎么引流推广
  • 成都万商云集做网站怎么样短视频seo询盘系统
  • 免费营销软件网站建设网络优化工程师简历
  • 网站可以做章子吗拼多多代运营公司十大排名
  • 网站建设公司价位百度账号登陆入口
  • 网站建设的课件商家联盟营销方案
  • seo网站营销推广全...推客平台