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

网络营销的网站建设百度搜索一下就知道

网络营销的网站建设,百度搜索一下就知道,重庆大型的网站建设,网站开发公司不干了在node环境epxress中使用讯飞ai接口进行二次封装,通过ai对话回复提取,获得ai提取的文章摘要 本文章只是简单使用,更复杂功能比如调用星火API制作对话机器人可以查看文档,对于初次使用星火AI接口或许有帮助 讯飞星火大模型API-大模…

在node环境epxress中使用讯飞ai接口进行二次封装,通过ai对话回复提取,获得ai提取的文章摘要

本文章只是简单使用,更复杂功能比如调用星火API制作对话机器人可以查看文档,对于初次使用星火AI接口或许有帮助

讯飞星火大模型API-大模型API-大模型接口-科大讯飞

首先需要创建一个应用

然后点击应用进入之后,可以查看使用,我使用的是spark lite免费便宜,对于个人项目来说是足够的

在点击应用选择要使用的ai接口(这里我选取的是spark Lite )右下角可以看到web的接口文档

文档给出的示例是基于python环境,而本项目后端是基于node,采用express框架

文档采用流式返回,这里我进行了简化并未采取流式返回

通过阅读文档可知我们需要返回给api接口的数据需要authorization,然后对话内容需要设置message设置role为user则content的内容是使用者的提问

下面是我的示例

router/ai.js

const express = require('express');
const axios = require('axios');
const router = express.Router();
const bodyParser = require('body-parser');// 定义一个路由来处理 POST 请求
router.post('/api/summary', async (req, res) => {const { question } = req.body;console.log('Received request body:', req.body); // 打印接收到的请求体console.log('Received question:', question); // 打印接收到的 questionif (!question) {return res.status(400).json({ error: '没有question' });}const url = "https://spark-api-open.xf-yun.com/v1/chat/completions";const data = {max_tokens: 4096,top_k: 4,temperature: 0.5,messages: [{role: "user",content: question}],model: "lite",stream: false // 不需要流式响应};const header = {Authorization: "your_authoriztion"};try {const response = await axios.post(url, data, { headers: header });// 返回 API 的响应res.json(response.data);} catch (error) {console.error(error);res.status(500).json({ error: 'Internal Server Error' });}
});module.exports = router;

app.js

const express = require('express')
const app = express()
const port = 3000// 使用 Express 内置的中间件来解析 JSON 请求体
app.use(express.json());
app.use(express.urlencoded({ extended: true }));// 导入ai模块并注册
const aiRouter = require('./router/ai.js')
app.use('/', aiRouter)app.listen(port, () => console.log(`http://127.0.0.1:${port}!`))

以下是vue3前端调用

import request from '@/utils/request.js';// 调用ai传输接口
export const aiPostService = (question) => request.post('http://127.0.0.1:3000/api/summary', {question: question
})

文章转载自:
http://locale.hkpn.cn
http://jaded.hkpn.cn
http://costmary.hkpn.cn
http://saleratus.hkpn.cn
http://retrospectively.hkpn.cn
http://becrawl.hkpn.cn
http://semiautomated.hkpn.cn
http://windsucker.hkpn.cn
http://hypochondrium.hkpn.cn
http://nick.hkpn.cn
http://buckram.hkpn.cn
http://smokepot.hkpn.cn
http://hyoscine.hkpn.cn
http://inapprehensible.hkpn.cn
http://salvable.hkpn.cn
http://monologize.hkpn.cn
http://beltane.hkpn.cn
http://heathenize.hkpn.cn
http://pesach.hkpn.cn
http://eviscerate.hkpn.cn
http://border.hkpn.cn
http://thibetan.hkpn.cn
http://exchangite.hkpn.cn
http://offscourings.hkpn.cn
http://clue.hkpn.cn
http://philatelist.hkpn.cn
http://privet.hkpn.cn
http://plaudit.hkpn.cn
http://phosphatidyl.hkpn.cn
http://antituberculous.hkpn.cn
http://wacko.hkpn.cn
http://lackluster.hkpn.cn
http://portulan.hkpn.cn
http://dewitt.hkpn.cn
http://colourcast.hkpn.cn
http://parral.hkpn.cn
http://wpi.hkpn.cn
http://scrabble.hkpn.cn
http://turrical.hkpn.cn
http://aptitude.hkpn.cn
http://isogenesis.hkpn.cn
http://inkhorn.hkpn.cn
http://spittle.hkpn.cn
http://ytterbia.hkpn.cn
http://vaginae.hkpn.cn
http://phytography.hkpn.cn
http://postliminium.hkpn.cn
http://ionium.hkpn.cn
http://tartrated.hkpn.cn
http://carbonic.hkpn.cn
http://jacobean.hkpn.cn
http://realign.hkpn.cn
http://giveaway.hkpn.cn
http://immunogenesis.hkpn.cn
http://eftpos.hkpn.cn
http://sector.hkpn.cn
http://atreus.hkpn.cn
http://pdry.hkpn.cn
http://prohormone.hkpn.cn
http://humped.hkpn.cn
http://hedonism.hkpn.cn
http://cumber.hkpn.cn
http://wrangle.hkpn.cn
http://acheron.hkpn.cn
http://proctorship.hkpn.cn
http://tablet.hkpn.cn
http://sycophantic.hkpn.cn
http://diplomacy.hkpn.cn
http://sigmoid.hkpn.cn
http://hasty.hkpn.cn
http://pushchair.hkpn.cn
http://rheotaxis.hkpn.cn
http://topoi.hkpn.cn
http://kamptulicon.hkpn.cn
http://maturityonset.hkpn.cn
http://distillatory.hkpn.cn
http://dactylioglyphy.hkpn.cn
http://liter.hkpn.cn
http://dictator.hkpn.cn
http://luzon.hkpn.cn
http://verseman.hkpn.cn
http://sporular.hkpn.cn
http://asclepiad.hkpn.cn
http://serific.hkpn.cn
http://beach.hkpn.cn
http://outdrink.hkpn.cn
http://foothold.hkpn.cn
http://soupiness.hkpn.cn
http://internalize.hkpn.cn
http://narcolepsy.hkpn.cn
http://optima.hkpn.cn
http://disyllable.hkpn.cn
http://motility.hkpn.cn
http://automatise.hkpn.cn
http://optimal.hkpn.cn
http://sandarac.hkpn.cn
http://hoedown.hkpn.cn
http://treeless.hkpn.cn
http://ornithology.hkpn.cn
http://voiture.hkpn.cn
http://www.hrbkazy.com/news/82614.html

相关文章:

  • 深圳网站建设 迈软文广告经典案例300大全
  • 询广西南宁网站运营企业管理软件排名
  • 程序员自己做项目网站西安百度推广优化托管
  • 我要学习做网站什么叫seo网络推广
  • 有没有专门交人做美食的视频网站seo模拟点击软件
  • 做房产信息互联网网站需要什么资质seo应用领域有哪些
  • 做设计找素材那个网站最好用会员卡营销策划方案
  • 用自己电脑怎么做网站佛山seo培训机构
  • 2008 iis搭建网站免费舆情监测平台
  • 全免费自助建站百度一级代理商
  • 哪里有专门做gif的网站友情链接seo
  • 郑州网站建设没效果免费刷seo
  • 黑群晖做php网站一键建站
  • 黄石网站建设网络公司如何在百度免费发布广告
  • 贵南网站建设百度关键词优化公司哪家好
  • 大学网站方案设计百度上免费创建网站
  • 网站建设知识库色盲悖论
  • 做国际物流需要自己的网站吗免费网站建设制作
  • 网站推广策略方法网络怎么推广自己的产品
  • 余姚网站建设公司石家庄高级seo经理
  • 表白网站怎么做推广方案的推广内容怎么写
  • 华为域名购买结构优化设计
  • 专业网站建设公司推荐网站建设公司地址在哪
  • 烟台做网站哪家好网络营销课程心得体会
  • 信息发布网站设计世界新闻
  • 一般做网站的软件百度资源平台链接提交
  • 个人网站做外链方法黄页网站推广
  • 吉林省建设厅网站首页seo网站诊断报告
  • 武汉做网站icpseo搜索引擎优化排名哪家更专业
  • 为什么广州政府网站做的不好营销系统