ChatGPTSharp
2.0.4
本项目基于ConversationId实现ChatGPT连续对话,只需几行代码即可快速集成。它支持gpt-4 、 gpt-4-vision-preview和gpt-3.5-turbo等模型。
中文
ChatGPTSharp 可作为 NuGet 包使用。
使用 ConversationId 进行连续对话。
ChatGPTClientSettings settings = new ChatGPTClientSettings ( ) ;
settings . OpenAIToken = File . ReadAllText ( " KEY.txt " ) ;
settings . ModelName = " gpt-4-vision-preview " ;
settings . ProxyUri = " http://127.0.0.1:1081 " ;
var client = new ChatGPTClient ( settings ) ;
client . IsDebug = true ;
var ChatImageModels = new List < ChatImageModel > ( )
{
ChatImageModel . CreateWithFile ( @"C:UsersaiqinPictures20231221155547.png" , ImageDetailMode . Low )
} ;
var systemPrompt = " " ;
var msg = await client . SendMessage ( " Please describe this image " , systemPrompt : systemPrompt , images : ChatImageModels ) ;
Console . WriteLine ( $" { msg . Response } { msg . ConversationId } , { msg . MessageId } " ) ;
msg = await client . SendMessage ( " Have you eaten today? " , msg . ConversationId , msg . MessageId ) ;
Console . WriteLine ( $" { msg . Response } { msg . ConversationId } , { msg . MessageId } " ) ;
该代码库引用了node-chatgpt-api