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