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

在喵窝网站怎么做图郑州百度推广seo

在喵窝网站怎么做图,郑州百度推广seo,在mac上安装wordpress,搞笑资讯网站源码一、使用介绍 官方网页:Ollama官方网址 中文文档参考:Ollama中文文档 相关教程:Ollama教程 使用版本:Unity 2022.3.53f1c1、Ollama 0.6.2 示例模型:llama3.2 二、运行示例 三、使用步骤 1、创建Canvas面板 具体…

一、使用介绍

官方网页:Ollama官方网址

中文文档参考:Ollama中文文档

相关教程:Ollama教程

使用版本:Unity 2022.3.53f1c1、Ollama 0.6.2

示例模型:llama3.2

二、运行示例

三、使用步骤

1、创建Canvas面板

具体层级如下

主要组件:发送按钮、输入框、滚动框

2、编写代码Webrequest

using System;
using System.Collections;
using System.Text;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
using Button = UnityEngine.UI.Button;public class Webrequest : MonoBehaviour
{//curl http://localhost:11434/api/generate -H "Content-Type: application/json" -d "{ \"model\": \"llama3\", \"prompt\": \"你好\", \"stream\": false }"public Text text;public InputField input;public Button sendBtn;public ScrollRect scrollRect;void Start(){sendBtn.onClick.AddListener(OnSend);}private void Update(){if (Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Return)){OnSend();}scrollRect.content.sizeDelta = text.rectTransform.sizeDelta;}void OnSend(){if (input.text != ""){text.text += $"你:{input.text}\n\n";scrollRect.verticalScrollbar.value = -0.1f;StartCoroutine(SendOllamaRequest(input.text));input.text = "";}else{text.text += "不能为空\n\n";scrollRect.verticalScrollbar.value = -0.1f;}}IEnumerator SendOllamaRequest(string value){// 目标 URLstring url = "http://localhost:11434/api/generate";string jsonData = $@"{{""model"": ""llama3.2"",""prompt"": ""{value}"",""stream"": false}}";// 创建 POST 请求UnityWebRequest request = new UnityWebRequest(url, "POST");byte[] bodyRaw = Encoding.UTF8.GetBytes(jsonData);request.uploadHandler = new UploadHandlerRaw(bodyRaw);request.downloadHandler = new DownloadHandlerBuffer();// 设置请求头request.SetRequestHeader("Content-Type", "application/json"); yield return request.SendWebRequest();// 处理响应if (request.result != UnityWebRequest.Result.Success){Debug.LogError($"Error: {request.error}");}else{string responseJson = request.downloadHandler.text;Debug.Log("Response: " + responseJson);// 解析 JSON 响应(示例)OllamaResponse response = JsonUtility.FromJson<OllamaResponse>(responseJson);// 访问字段Debug.Log($"模型: {response.model}");Debug.Log($"回复: {response.response}");text.text += "智能体:" + response.response + "\n\n";Debug.Log($"生成耗时: {response.eval_duration / 1e12} 秒");scrollRect.verticalNormalizedPosition = -0.1f;}}
}

3、将代码拖到场景中

将场景对应的对象拖动到Webrequest上

4、运行场景

输入对话内容,点击发送,等待AI回应

http://www.dtcms.com/wzjs/100370.html

相关文章:

  • 做网站搞笑口号网络营销推广论文
  • 百度网站地图怎么做成都seo服务
  • 做网站要固定电话天津搜狗seo推广
  • 网站建设客户告知书百度一下百度网页官
  • 页面兼容性测试网站新手做网络销售难吗
  • 技术支持 广州网站建设网络推广赚钱项目
  • 网站建设 甘肃自建网站流程
  • 丹东网站开发沈阳网站关键字优化
  • 自己做网站 为什么出现403大庆黄页查询电话
  • 新乡市建设路小学网站好的seo网站
  • 做网站需要收付款功能吗商丘网站seo
  • 成都私人做网站seo案例视频教程
  • 网站自定义titlesem竞价托管代运营
  • 网站统计代码怎么添加如何做好网络营销
  • 洪山网站建设简述网络营销与传统营销的整合
  • 达州+网站建设自己怎么搭建网站
  • 做的网站底部应该标注什么淘宝网官方网站
  • 高新区规划建设局网站2023年8月新冠又来了
  • 保定专业做网站公司seo公司后付费
  • 沈阳网站制作公司和服务器互联网公司排名
  • 建设网站找什么条件北京网络网站推广
  • 芜湖网站建设芜湖西安全网优化
  • 深圳市光明区属于哪个区杭州seo推广排名稳定
  • jq 网站模板百度移动端模拟点击排名
  • 买了香港主机后建站 写一个网站维修页面创建网页
  • 国内 织梦和wordpress上海seo服务外包公司
  • 网站出现乱码怎么办好的竞价托管公司
  • 做影视后期有哪些资源网站bt搜索引擎
  • wordpress模板字体修改关键词营销优化
  • 做dw网站图片怎么下载网络推广营销软件