commit 4ecaeaa3eb5dc64f2c10b3c42680e1692798730d Author: Lukáš Kaňka <124378142+LukasKanka@users.noreply.github.com> Date: Sat Sep 2 20:15:01 2023 +0200 openAI, C#, VS2022 diff --git a/openAI/.vs/ProjectEvaluation/openai.metadata.v7.bin b/openAI/.vs/ProjectEvaluation/openai.metadata.v7.bin new file mode 100644 index 0000000..5fe348c Binary files /dev/null and b/openAI/.vs/ProjectEvaluation/openai.metadata.v7.bin differ diff --git a/openAI/.vs/ProjectEvaluation/openai.projects.v7.bin b/openAI/.vs/ProjectEvaluation/openai.projects.v7.bin new file mode 100644 index 0000000..a5d79de Binary files /dev/null and b/openAI/.vs/ProjectEvaluation/openai.projects.v7.bin differ diff --git a/openAI/.vs/openAI/DesignTimeBuild/.dtbcache.v2 b/openAI/.vs/openAI/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..c542cee Binary files /dev/null and b/openAI/.vs/openAI/DesignTimeBuild/.dtbcache.v2 differ diff --git a/openAI/.vs/openAI/FileContentIndex/decc207b-fd56-4ede-a019-3fef43192343.vsidx b/openAI/.vs/openAI/FileContentIndex/decc207b-fd56-4ede-a019-3fef43192343.vsidx new file mode 100644 index 0000000..8f576f6 Binary files /dev/null and b/openAI/.vs/openAI/FileContentIndex/decc207b-fd56-4ede-a019-3fef43192343.vsidx differ diff --git a/openAI/.vs/openAI/FileContentIndex/e1d07077-a45c-4fdd-8225-9c2fa63f3f4d.vsidx b/openAI/.vs/openAI/FileContentIndex/e1d07077-a45c-4fdd-8225-9c2fa63f3f4d.vsidx new file mode 100644 index 0000000..efab86a Binary files /dev/null and b/openAI/.vs/openAI/FileContentIndex/e1d07077-a45c-4fdd-8225-9c2fa63f3f4d.vsidx differ diff --git a/openAI/.vs/openAI/v17/.futdcache.v2 b/openAI/.vs/openAI/v17/.futdcache.v2 new file mode 100644 index 0000000..850003f Binary files /dev/null and b/openAI/.vs/openAI/v17/.futdcache.v2 differ diff --git a/openAI/.vs/openAI/v17/.suo b/openAI/.vs/openAI/v17/.suo new file mode 100644 index 0000000..8679278 Binary files /dev/null and b/openAI/.vs/openAI/v17/.suo differ diff --git a/openAI/.vs/openAI/v17/TestStore/0/000.testlog b/openAI/.vs/openAI/v17/TestStore/0/000.testlog new file mode 100644 index 0000000..6bbf10e Binary files /dev/null and b/openAI/.vs/openAI/v17/TestStore/0/000.testlog differ diff --git a/openAI/.vs/openAI/v17/TestStore/0/testlog.manifest b/openAI/.vs/openAI/v17/TestStore/0/testlog.manifest new file mode 100644 index 0000000..e92ede2 Binary files /dev/null and b/openAI/.vs/openAI/v17/TestStore/0/testlog.manifest differ diff --git a/openAI/openAI.sln b/openAI/openAI.sln new file mode 100644 index 0000000..f0d1a83 --- /dev/null +++ b/openAI/openAI.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34018.315 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "openAI", "openAI\openAI.csproj", "{99574B35-B25B-4DC2-88B3-3F4AC2938B60}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {99574B35-B25B-4DC2-88B3-3F4AC2938B60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99574B35-B25B-4DC2-88B3-3F4AC2938B60}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99574B35-B25B-4DC2-88B3-3F4AC2938B60}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99574B35-B25B-4DC2-88B3-3F4AC2938B60}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {54F49607-DB1A-4A6C-A03A-DE3126ED8C0E} + EndGlobalSection +EndGlobal diff --git a/openAI/openAI/AI.cs b/openAI/openAI/AI.cs new file mode 100644 index 0000000..95b979a --- /dev/null +++ b/openAI/openAI/AI.cs @@ -0,0 +1,36 @@ +using OpenAI_API; +using OpenAI_API.Chat; +using OpenAI_API.Models; +using System.Reflection; + +List messages = new(); +messages.Add(new ChatMessage(ChatMessageRole.System, "Odpovídej v bodech")); +Console.WriteLine("Nazdárek jsem tvá osobní AI, co tě zajímá?"); + + +while (true) +{ + + string question = Console.ReadLine(); + messages.Add(new ChatMessage(ChatMessageRole.User, question)); + + + var ai = new OpenAIAPI(new APIAuthentication("Jsem vložíš API key", "Jsem vložíš Organization ID")); + + ChatRequest request = new ChatRequest(); + request.user = "Lukáš Kaňka"; + request.Model = Model.ChatGPTTurbo; + request.Messages = messages; + request.Temperature = 0.7; + request.MaxTokens = 500; + + + + + var response = await ai.Chat.CreateChatCompletionAsync(request); + string answer = response.Choices.FirstOrDefault().Message.Content; + messages.Add(response.Choices.FirstOrDefault().Message); + Console.WriteLine(answer); +} + + diff --git a/openAI/openAI/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs b/openAI/openAI/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs new file mode 100644 index 0000000..4257f4b --- /dev/null +++ b/openAI/openAI/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")] diff --git a/openAI/openAI/obj/Debug/net7.0/openAI.AssemblyInfo.cs b/openAI/openAI/obj/Debug/net7.0/openAI.AssemblyInfo.cs new file mode 100644 index 0000000..13e755d --- /dev/null +++ b/openAI/openAI/obj/Debug/net7.0/openAI.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("openAI")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("openAI")] +[assembly: System.Reflection.AssemblyTitleAttribute("openAI")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/openAI/openAI/obj/Debug/net7.0/openAI.AssemblyInfoInputs.cache b/openAI/openAI/obj/Debug/net7.0/openAI.AssemblyInfoInputs.cache new file mode 100644 index 0000000..2f6cec3 --- /dev/null +++ b/openAI/openAI/obj/Debug/net7.0/openAI.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +af3f50c41144112b020ab5c5c97efc013b493ed1 diff --git a/openAI/openAI/obj/Debug/net7.0/openAI.GeneratedMSBuildEditorConfig.editorconfig b/openAI/openAI/obj/Debug/net7.0/openAI.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..2b66f1b --- /dev/null +++ b/openAI/openAI/obj/Debug/net7.0/openAI.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,11 @@ +is_global = true +build_property.TargetFramework = net7.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = openAI +build_property.ProjectDir = C:\Users\lukas\Nextcloud\GitHub\openAIconsoleClient\openAI\openAI\ diff --git a/openAI/openAI/obj/Debug/net7.0/openAI.GlobalUsings.g.cs b/openAI/openAI/obj/Debug/net7.0/openAI.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/openAI/openAI/obj/Debug/net7.0/openAI.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/openAI/openAI/obj/Debug/net7.0/openAI.assets.cache b/openAI/openAI/obj/Debug/net7.0/openAI.assets.cache new file mode 100644 index 0000000..bef71cb Binary files /dev/null and b/openAI/openAI/obj/Debug/net7.0/openAI.assets.cache differ diff --git a/openAI/openAI/obj/openAI.csproj.nuget.dgspec.json b/openAI/openAI/obj/openAI.csproj.nuget.dgspec.json new file mode 100644 index 0000000..95dd6f0 --- /dev/null +++ b/openAI/openAI/obj/openAI.csproj.nuget.dgspec.json @@ -0,0 +1,63 @@ +{ + "format": 1, + "restore": { + "C:\\Users\\lukas\\Nextcloud\\GitHub\\openAIconsoleClient\\openAI\\openAI\\openAI.csproj": {} + }, + "projects": { + "C:\\Users\\lukas\\Nextcloud\\GitHub\\openAIconsoleClient\\openAI\\openAI\\openAI.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\lukas\\Nextcloud\\GitHub\\openAIconsoleClient\\openAI\\openAI\\openAI.csproj", + "projectName": "openAI", + "projectPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\openAIconsoleClient\\openAI\\openAI\\openAI.csproj", + "packagesPath": "C:\\Users\\lukas\\.nuget\\packages\\", + "outputPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\openAIconsoleClient\\openAI\\openAI\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\lukas\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net7.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.400\\RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/openAI/openAI/obj/openAI.csproj.nuget.g.props b/openAI/openAI/obj/openAI.csproj.nuget.g.props new file mode 100644 index 0000000..4270eed --- /dev/null +++ b/openAI/openAI/obj/openAI.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\lukas\.nuget\packages\ + PackageReference + 6.7.0 + + + + + \ No newline at end of file diff --git a/openAI/openAI/obj/openAI.csproj.nuget.g.targets b/openAI/openAI/obj/openAI.csproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/openAI/openAI/obj/openAI.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/openAI/openAI/obj/project.assets.json b/openAI/openAI/obj/project.assets.json new file mode 100644 index 0000000..c59a314 --- /dev/null +++ b/openAI/openAI/obj/project.assets.json @@ -0,0 +1,68 @@ +{ + "version": 3, + "targets": { + "net7.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net7.0": [] + }, + "packageFolders": { + "C:\\Users\\lukas\\.nuget\\packages\\": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\lukas\\Nextcloud\\GitHub\\openAIconsoleClient\\openAI\\openAI\\openAI.csproj", + "projectName": "openAI", + "projectPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\openAIconsoleClient\\openAI\\openAI\\openAI.csproj", + "packagesPath": "C:\\Users\\lukas\\.nuget\\packages\\", + "outputPath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\openAIconsoleClient\\openAI\\openAI\\obj\\", + "projectStyle": "PackageReference", + "configFilePaths": [ + "C:\\Users\\lukas\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "net7.0" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "net7.0": { + "targetAlias": "net7.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.400\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/openAI/openAI/obj/project.nuget.cache b/openAI/openAI/obj/project.nuget.cache new file mode 100644 index 0000000..ca6f423 --- /dev/null +++ b/openAI/openAI/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "TvNUkNYNeKmgP4EpteBZUn0lQscM3E855NG74/V/Vz4fuW8JkfF3EKCgvxzc7JcpcFT1mK+LZD1osdxAoJYhXg==", + "success": true, + "projectFilePath": "C:\\Users\\lukas\\Nextcloud\\GitHub\\openAIconsoleClient\\openAI\\openAI\\openAI.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/openAI/openAI/openAI.csproj b/openAI/openAI/openAI.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/openAI/openAI/openAI.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + +