提交代码
This commit is contained in:
parent
70126fb307
commit
796bff8e49
|
|
@ -29,7 +29,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HuanMeng.StableDiffusion.Te
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HuanMeng.StableDiffusion.TextGenerationTests", "src\9-test\HuanMeng.StableDiffusion.TextGenerationTests\HuanMeng.StableDiffusion.TextGenerationTests.csproj", "{054AFFF5-D25E-4EC7-A135-050EEE7F7FA0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextGenerationApi", "src\2-api\TextGenerationApi\TextGenerationApi.csproj", "{A9C5939E-D239-4AB8-9380-7E76166326D9}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TextGenerationApi", "src\2-api\TextGenerationApi\TextGenerationApi.csproj", "{A9C5939E-D239-4AB8-9380-7E76166326D9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HuanMnegopneaiTest", "src\5-console\HuanMnegopneaiTest\HuanMnegopneaiTest.csproj", "{D2A74CFA-8A03-4272-89C7-C01830D183F1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
@ -61,6 +63,10 @@ Global
|
|||
{A9C5939E-D239-4AB8-9380-7E76166326D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A9C5939E-D239-4AB8-9380-7E76166326D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A9C5939E-D239-4AB8-9380-7E76166326D9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D2A74CFA-8A03-4272-89C7-C01830D183F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D2A74CFA-8A03-4272-89C7-C01830D183F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D2A74CFA-8A03-4272-89C7-C01830D183F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D2A74CFA-8A03-4272-89C7-C01830D183F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -79,6 +85,7 @@ Global
|
|||
{CFE784F8-3889-4698-8719-55BAB1724486} = {DD14191F-22CE-48D8-A944-B8A41C97ACD4}
|
||||
{054AFFF5-D25E-4EC7-A135-050EEE7F7FA0} = {8D39E84B-2810-41D7-AFE6-0A58E09E34C3}
|
||||
{A9C5939E-D239-4AB8-9380-7E76166326D9} = {0C0B6EB5-E41D-46D9-9F60-90D320A2EEF3}
|
||||
{D2A74CFA-8A03-4272-89C7-C01830D183F1} = {F34C5BC4-8810-4D6A-B003-AFE12D7ED4BA}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4A1DC406-AFAA-4884-859C-51B9B26E37FC}
|
||||
|
|
|
|||
14
src/5-console/HuanMnegopneaiTest/HuanMnegopneaiTest.csproj
Normal file
14
src/5-console/HuanMnegopneaiTest/HuanMnegopneaiTest.csproj
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OpenAI" Version="1.11.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
14
src/5-console/HuanMnegopneaiTest/Program.cs
Normal file
14
src/5-console/HuanMnegopneaiTest/Program.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
using OpenAI_API.Models;
|
||||
using System;
|
||||
|
||||
Console.WriteLine("Hello, World!");
|
||||
//var api = new OpenAI_API.OpenAIAPI("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");
|
||||
var api = new OpenAI_API.OpenAIAPI("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");
|
||||
//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
|
||||
var chat = api.Chat.CreateConversation();
|
||||
chat.Model = Model.Davinci;
|
||||
chat.RequestParameters.Temperature = 0;
|
||||
chat.AppendUserInput("哈喽");
|
||||
var result = await chat.GetResponseFromChatbotAsync();
|
||||
Console.WriteLine(result);
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using HuanMeng.StableDiffusion.TextGeneration.Abstractions;
|
||||
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -14,12 +16,12 @@ namespace HuanMeng.StableDiffusion.TextGeneration.api.Tests
|
|||
[TestMethod()]
|
||||
public async Task SendMessageAsyncTest()
|
||||
{
|
||||
TextGenerationRequestHttpApiStream textGenerationRequestHttpApi = new TextGenerationRequestHttpApi();
|
||||
TextGenerationRequestAbstract textGenerationRequestHttpApi = new TextGenerationRequestHttpApi("");
|
||||
await foreach (var item in textGenerationRequestHttpApi.SendMessageAsync())
|
||||
{
|
||||
Console.WriteLine(item);
|
||||
}
|
||||
Console.WriteLine(textGenerationRequestHttpApi.textGenerationRequestHttpModel.Choices[0].Delta.Content);
|
||||
Console.WriteLine(textGenerationRequestHttpApi.textGenerationModel.Model);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user