惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
S
Secure Thoughts
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
Google DeepMind News
Google DeepMind News
雷峰网
雷峰网
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
罗磊的独立博客
T
Threat Research - Cisco Blogs
Cyberwarzone
Cyberwarzone
V
Vulnerabilities – Threatpost
Microsoft Azure Blog
Microsoft Azure Blog
Cisco Talos Blog
Cisco Talos Blog
The Hacker News
The Hacker News
I
InfoQ
F
Full Disclosure
L
LangChain Blog
D
DataBreaches.Net
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
Vercel News
Vercel News
S
Schneier on Security
博客园 - 叶小钗
L
Lohrmann on Cybersecurity
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Know Your Adversary
Know Your Adversary
Scott Helme
Scott Helme
NISL@THU
NISL@THU
G
Google Developers Blog
T
Threatpost
AI
AI
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
I
Intezer
IT之家
IT之家
Security Archives - TechRepublic
Security Archives - TechRepublic
Help Net Security
Help Net Security
K
Kaspersky official blog
H
Hacker News: Front Page
D
Docker
Project Zero
Project Zero
博客园 - 【当耐特】
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
The Register - Security
The Register - Security
PCI Perspectives
PCI Perspectives
Schneier on Security
Schneier on Security

博客园 - 过错

vscode的continue中配置第三方模型。以agnes-ai为例 在 Docker 容器中运行 .NET 6 并使用 libgdiplus(通常是为了支持 System.Drawing.Common 进行图片处理),你需要完成以下两个核心步骤 vs code调试netcore 为Ubuntu24生成netcore10的镜像, linux安装netcore nginx postgresql ssh 各种加速 不使用Debezium,记录PostgreSQL中的数据的数据前后变化 docker加速 python的一些设置 netcore 发布命令 一些代码库 The database cluster initialisation failed but was not the same version as initdb的解决办法(postgresql) NDVI计算 ,c#和python代码实现 vs Commit message的使用 Fiddler 替换资源 docker 部署 rabbitmq(持久化) 和postgresql redis mysql 油猴子常用脚本 通过nginx做身份验证网关的方法 ngnix 常用配置 Nginx配置之实现多台服务器负载均衡 Nginx配置优化详解 ngnix代理grpc
使用c#调用chatgpt 。以下代码由ai自动生成。
过错 · 2023-04-14 · via 博客园 - 过错

using System;
using System.IO;
using System.Net;
using System.Text;

class Program
{
static void Main()
{
// API的URL
string apiUrl = "https://api.openai.com/v1/chat/completions";

// 设置API的请求头
WebRequest request = WebRequest.Create(apiUrl);
request.Method = "POST";
request.Headers.Add("Authorization", "Bearer {YOUR_API_KEY}"); // 替换为你的API密钥
request.ContentType = "application/json";

// 设置API的请求体,包含输入和参数
string input = "请问天气怎么样?";
string prompt = "用户:" + input + "\n助理:";
int maxTokens = 50;
string requestBody = "{ "messages": [{ "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "" + prompt + "" }], "max_tokens": " + maxTokens + " }";
byte[] byteArray = Encoding.UTF8.GetBytes(requestBody);
request.ContentLength = byteArray.Length;

// 发送请求并获取响应
using (Stream dataStream = request.GetRequestStream())
{
dataStream.Write(byteArray, 0, byteArray.Length);
}
WebResponse response = request.GetResponse();
using (Stream responseStream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
string responseJson = reader.ReadToEnd();
Console.WriteLine(responseJson);
// 在这里处理API的响应
}
response.Close();
}
}