Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaexplorer74 committed May 19, 2024
1 parent 3e985dc commit 738c0f9
Show file tree
Hide file tree
Showing 64 changed files with 89 additions and 50 deletions.
Binary file modified .vs/ChatX/v17/.futdcache.v2
Binary file not shown.
Binary file modified ChatX/ChatX.UWP/Assets/LargeTile.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/LargeTile.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/LargeTile.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/LargeTile.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/LargeTile.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SmallTile.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SmallTile.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SmallTile.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SmallTile.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SmallTile.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SplashScreen.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SplashScreen.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SplashScreen.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/SplashScreen.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/Square150x150Logo.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/Square150x150Logo.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/Square150x150Logo.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/Square150x150Logo.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.scale-100.png
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.scale-125.png
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.scale-150.png
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.scale-200.png
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.scale-400.png
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.targetsize-16.png
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.targetsize-24.png
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.targetsize-256.png
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.targetsize-32.png
Binary file modified ChatX/ChatX.UWP/Assets/Square44x44Logo.targetsize-48.png
Binary file modified ChatX/ChatX.UWP/Assets/StoreLogo.scale-100.png
Binary file modified ChatX/ChatX.UWP/Assets/StoreLogo.scale-125.png
Binary file modified ChatX/ChatX.UWP/Assets/StoreLogo.scale-150.png
Binary file modified ChatX/ChatX.UWP/Assets/StoreLogo.scale-200.png
Binary file modified ChatX/ChatX.UWP/Assets/StoreLogo.scale-400.png
Binary file modified ChatX/ChatX.UWP/Assets/Wide310x150Logo.scale-100.png
Binary file modified ChatX/ChatX.UWP/Assets/Wide310x150Logo.scale-125.png
Binary file modified ChatX/ChatX.UWP/Assets/Wide310x150Logo.scale-150.png
Binary file modified ChatX/ChatX.UWP/Assets/Wide310x150Logo.scale-200.png
Binary file modified ChatX/ChatX.UWP/Assets/Wide310x150Logo.scale-400.png
5 changes: 5 additions & 0 deletions ChatX/ChatX.UWP/BundleArtifacts/arm.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MainPackage=C:\Users\Admin\source\repos\!AI\ChatX\ChatX\ChatX.UWP\bin\ARM\Debug\ChatX.UWP_1.0.0.0_ARM_Debug.appx
ResourcePack=C:\Users\Admin\source\repos\!AI\ChatX\ChatX\ChatX.UWP\bin\ARM\Debug\ChatX.UWP_1.0.0.0_scale-100.appx
ResourcePack=C:\Users\Admin\source\repos\!AI\ChatX\ChatX\ChatX.UWP\bin\ARM\Debug\ChatX.UWP_1.0.0.0_scale-125.appx
ResourcePack=C:\Users\Admin\source\repos\!AI\ChatX\ChatX\ChatX.UWP\bin\ARM\Debug\ChatX.UWP_1.0.0.0_scale-150.appx
ResourcePack=C:\Users\Admin\source\repos\!AI\ChatX\ChatX\ChatX.UWP\bin\ARM\Debug\ChatX.UWP_1.0.0.0_scale-400.appx
14 changes: 11 additions & 3 deletions ChatX/ChatX.UWP/ChatX.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
<PackageCertificateThumbprint>2B942139C1BC2CC3453296445AA2F4C508F9078C</PackageCertificateThumbprint>
<AppxBundlePlatforms>arm</AppxBundlePlatforms>
<PackageCertificateThumbprint>
</PackageCertificateThumbprint>
<PackageCertificateKeyFile>ChatX.UWP_TemporaryKey.pfx</PackageCertificateKeyFile>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Always</AppxBundle>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
Expand Down
Binary file modified ChatX/ChatX.UWP/ChatX.UWP_TemporaryKey.pfx
Binary file not shown.
4 changes: 2 additions & 2 deletions ChatX/ChatX.UWP/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<mp:PhoneIdentity PhoneProductId="e10cc741-fd3e-485c-81b1-68815c882590" PhonePublisherId="00258800-8825-8060-0000-000000004400"/>

<Properties>
<DisplayName>XamarinSignalRExample.UWP</DisplayName>
<DisplayName>ChatX v1.0</DisplayName>
<PublisherDisplayName>mediaexplorer</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
Expand All @@ -32,7 +32,7 @@
Executable="$targetnametoken$.exe"
EntryPoint="XamarinSignalRExample.UWP.App">
<uap:VisualElements
DisplayName="ChatX"
DisplayName="ChatX 1.0"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="ChatX.UWP"
Expand Down
95 changes: 59 additions & 36 deletions ChatX/ChatX/ChatGpt.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ChatGPT 'clone' (PrivateAI)
// ChatGPT (PrivateAI)

using System;
using System.Net.Http;
Expand All @@ -7,58 +7,81 @@
using Newtonsoft.Json.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace XamarinSignalRExample
{
public class ChatGpt
{
private readonly string ApiKey = ""; // paste your key here
private string v;
private ChatGptOptions chatGptOptions;
public string ApiKey = "c72d5e9641764f159d57f5ad3313b7b4"; // paste your key here
string processtext_url = "https://api.private-ai.com/deid/v3/process/text";

public ChatGpt(string v, ChatGptOptions chatGptOptions)

public ChatGptOptions chatGptOptions;

public ChatGpt(/*string apikey, */ChatGptOptions chatGptOptions)
{
this.v = v;
/*this.ApiKey = apikey;*/
this.chatGptOptions = chatGptOptions;
}

public async Task<string> AskStream(Action<string> message1, string prompt, string v)
public async Task<string> AskStream(/*Action<string> message1,*/ string prompt)
{
string response = "";
using (var client = new HttpClient())
string result = "";


try
{
JObject json = JObject.Parse(
@"{
text: [
'Hello everyone, kidfive- my mom is on Tucatinib, similar to you she had brain mets in 2015, september craniotomy and srs and gamma knife October and November of that year. Yes her oncologist is very excited about Tucatinib, this is the reason why I’m actually here today, we had her follow up brain mri end of June, everything was good, recently she was hospitalized for high iron, during her hospitalization they did another brain mri (this is a different hospital than where we do the follow ups) and they said where that where they did the gamma there is an 14mm lesion now and a lesion where they did the craniotomy there is a lesion there too, so now im confused i don’t know what to do , I’m hoping there’s no lesion and this Tucatinib will take care of it. Has anyone experienced two different brain mri results'
],
link_batch: false,
entity_detection:
using (HttpClient client = new HttpClient())
{
entity_types: [

var json =
@"{
text: [
'*PROMPT*'
],
link_batch: false,
entity_detection:
{
type: 'ENABLE',
value: ['ACCOUNT_NUMBER','AGE','DATE','DATE_INTERVAL','DOB','DRIVER_LICENSE','DURATION','EMAIL_ADDRESS','EVENT','FILENAME','GENDER_SEXUALITY','HEALTHCARE_NUMBER','IP_ADDRESS','LANGUAGE','LOCATION','LOCATION_ADDRESS','LOCATION_ADDRESS_STREET','LOCATION_CITY','LOCATION_COORDINATE','LOCATION_COUNTRY','LOCATION_STATE','LOCATION_ZIP','MARITAL_STATUS','MONEY','NAME','NAME_FAMILY','NAME_GIVEN','NAME_MEDICAL_PROFESSIONAL','NUMERICAL_PII','ORGANIZATION','ORGANIZATION_MEDICAL_FACILITY','OCCUPATION','ORIGIN','PASSPORT_NUMBER','PASSWORD','PHONE_NUMBER','PHYSICAL_ATTRIBUTE','POLITICAL_AFFILIATION','RELIGION','SSN','TIME','URL','USERNAME','VEHICLE_ID','ZODIAC_SIGN','BLOOD_TYPE','CONDITION','DOSE','DRUG','INJURY','MEDICAL_PROCESS','STATISTICS','BANK_ACCOUNT','CREDIT_CARD','CREDIT_CARD_EXPIRATION','CVV','ROUTING_NUMBER']
entity_types: [
{
type: 'ENABLE',
value: ['ACCOUNT_NUMBER','AGE','DATE','DATE_INTERVAL','DOB','DRIVER_LICENSE','DURATION','EMAIL_ADDRESS','EVENT','FILENAME','GENDER_SEXUALITY','HEALTHCARE_NUMBER','IP_ADDRESS','LANGUAGE','LOCATION','LOCATION_ADDRESS','LOCATION_ADDRESS_STREET','LOCATION_CITY','LOCATION_COORDINATE','LOCATION_COUNTRY','LOCATION_STATE','LOCATION_ZIP','MARITAL_STATUS','MONEY','NAME','NAME_FAMILY','NAME_GIVEN','NAME_MEDICAL_PROFESSIONAL','NUMERICAL_PII','ORGANIZATION','ORGANIZATION_MEDICAL_FACILITY','OCCUPATION','ORIGIN','PASSPORT_NUMBER','PASSWORD','PHONE_NUMBER','PHYSICAL_ATTRIBUTE','POLITICAL_AFFILIATION','RELIGION','SSN','TIME','URL','USERNAME','VEHICLE_ID','ZODIAC_SIGN','BLOOD_TYPE','CONDITION','DOSE','DRUG','INJURY','MEDICAL_PROCESS','STATISTICS','BANK_ACCOUNT','CREDIT_CARD','CREDIT_CARD_EXPIRATION','CVV','ROUTING_NUMBER']
}
],
return_entity: true
},
processed_text: {
type: 'MARKER',
pattern: '[UNIQUE_NUMBERED_ENTITY_TYPE]'
}
],
return_entity: true
},
processed_text: {
type: 'MARKER',
pattern: '[UNIQUE_NUMBERED_ENTITY_TYPE]'
}
}");
}";

var postData = new StringContent(json.ToString(), Encoding.UTF8, "application/json");
postData.Headers.Add("X-API-KEY", ApiKey);
var request = await client.PostAsync("https://api.private-ai.com/deid/v3/process/text", postData);

response = await request.Content.ReadAsStringAsync();
string o_json = json.Replace("*PROMPT*", prompt);

Debug.WriteLine(response);
}
JObject jo = JObject.Parse(o_json);

return response;
StringContent postData = new StringContent(jo.ToString(), Encoding.UTF8, "application/json");

postData.Headers.Add("x-api-key", ApiKey);

HttpResponseMessage response = await client.PostAsync(processtext_url, postData);

response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();

Debug.WriteLine("[i] " + responseBody);

result = responseBody;
}

}
catch (HttpRequestException ex)
{
Debug.WriteLine("[ex] Exception Message :{0} ", ex.Message);
}

return result;
}
}
}
}
2 changes: 1 addition & 1 deletion ChatX/ChatX/ChatX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Xamarin.Forms" Version="2.5.1.527436" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions ChatX/ChatX/XamarinSignalRExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public App()

//******************

ChatGpt bot = new ChatGpt
("pk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
ChatGpt chatbot = new ChatGpt
(//"pk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
new ChatGptOptions
{
BaseUrl = "https://api.pawan.krd"
Expand Down Expand Up @@ -110,10 +110,10 @@ public App()

Debug.Write("ChatGPT: prompt=" + prompt);

System.Action<string> message1 = default;
//System.Action<string> message1 = default;

//await
string str = await bot.AskStream(/*Console.Write*/message1, prompt, "default");
string str = await chatbot.AskStream(/*message1, */prompt);

Debug.WriteLine(" Your message = " + prompt);
//}
Expand Down
Binary file modified Images/logo.png
Binary file added Images/shot01.png
Binary file added Images/shot02.png
Binary file added Images/shot03.png
Binary file removed Images/shot1.png
Diff not rendered.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ChatX
![ChatGPT](Images/logo.png)

My experimental GhatGPT-like project based on PrivateAI api.
My experimental GhatGPT-like project (prototape) based on modern PrivateAI "Cloud" api.

Warning: PrivateAI is privatedata-oriented version of ChatGPT... but it's also ChatGPT ;)

Expand All @@ -11,11 +11,14 @@ Free plan has some limits like 4 messegas per second & 75 messages per day. It's
A simple multi-platform implementation of a Xamarin.Forms AI app mixed with PrivateAI-based api. ;)

## Screenshots
![Shot 1](Images/shot1.png)

![ChatX on Win11 Desktop](Images/shot01.png)
![ChatX on W10M](Images/shot02.png)
![PrivateGPT web-site](Images/shot03.png)

## Tech. moments
### Min. Win. OS build SDK = 15063

### Min. Win. OS build SDK = 10240 (Hello, Astoria!)

### Solution's Architecture
- Client : ChatX shared project; ChatX.UWP, ChatX.Droid, ChatX.iOS target-dependant projects
- Server : https://private-ai.com
Expand Down

0 comments on commit 738c0f9

Please sign in to comment.