-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: nativeaot support for nuget package
- switch to sourcegen serialization - fix minor warnings - move some array allocations to constants - rename some types to resolve name conflicts (request vs response)
- Loading branch information
1 parent
debf3b9
commit 916ce5d
Showing
8 changed files
with
198 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ obj/ | |
riderModule.iml | ||
/_ReSharper.Caches/ | ||
.idea/ | ||
build/ | ||
.DS_Store | ||
build/ | ||
publish/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
namespace BingChat; | ||
|
||
internal static class BingChatConstants | ||
{ | ||
internal static readonly string[] OptionSets = new[] | ||
{ | ||
"nlu_direct_response_filter", | ||
"deepleo", | ||
"enable_debug_commands", | ||
"disable_emoji_spoken_text", | ||
"responsible_ai_policy_235", | ||
"enablemm", | ||
"cachewriteext", | ||
"e2ecachewrite", | ||
"nodlcpcwrite", | ||
"nointernalsugg", | ||
"saharasugg", | ||
"rai267", | ||
"sportsansgnd", | ||
"enablenewsfc", | ||
"dv3sugg", | ||
"autosave", | ||
"dlislog" | ||
}; | ||
|
||
internal static readonly string[] CreativeOptionSets = OptionSets | ||
.Concat(new[] { "h3imaginative", "clgalileo", "gencontentv3" }) | ||
.ToArray(); | ||
|
||
internal static readonly string[] PreciseOptionSets = OptionSets | ||
.Concat(new[] { "h3precise", "clgalileo", "gencontentv3" }) | ||
.ToArray(); | ||
|
||
internal static readonly string[] BalancedOptionSets = OptionSets | ||
.Concat(new[] { "galileo" }) | ||
.ToArray(); | ||
|
||
internal static readonly string[] AllowedMessageTypes = new[] | ||
{ | ||
"Chat", | ||
"InternalSearchQuery", | ||
"InternalSearchResult", | ||
"InternalLoaderMessage", | ||
"RenderCardRequest", | ||
"AdsQuery", | ||
"SemanticSerp" | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
// ReSharper disable MemberCanBeInternal | ||
// ReSharper disable ClassNeverInstantiated.Global | ||
// ReSharper disable UnusedAutoPropertyAccessor.Global | ||
|
||
#pragma warning disable CS8618 | ||
|
||
namespace BingChat; | ||
|
||
internal sealed class BingChatConversationRequest | ||
{ | ||
[JsonPropertyName("type")] | ||
public int Type { get; set; } | ||
|
||
[JsonPropertyName("invocationId")] | ||
public string InvocationId { get; set; } | ||
|
||
[JsonPropertyName("target")] | ||
public string Target { get; set; } | ||
|
||
[JsonPropertyName("arguments")] | ||
public RequestArgument[] Arguments { get; set; } | ||
} | ||
|
||
internal sealed class RequestArgument | ||
{ | ||
[JsonPropertyName("source")] | ||
public string Source { get; set; } | ||
|
||
[JsonPropertyName("optionsSets")] | ||
public string[] OptionsSets { get; set; } | ||
|
||
[JsonPropertyName("allowedMessageTypes")] | ||
public string[] AllowedMessageTypes { get; set; } | ||
|
||
[JsonPropertyName("sliceIds")] | ||
public string[] SliceIds { get; set; } | ||
|
||
[JsonPropertyName("traceId")] | ||
public string TraceId { get; set; } | ||
|
||
[JsonPropertyName("isStartOfSession")] | ||
public bool IsStartOfSession { get; set; } | ||
|
||
[JsonPropertyName("message")] | ||
public RequestMessage Message { get; set; } | ||
|
||
[JsonPropertyName("tone")] | ||
public string Tone { get; set; } | ||
|
||
[JsonPropertyName("conversationSignature")] | ||
public string ConversationSignature { get; set; } | ||
|
||
[JsonPropertyName("participant")] | ||
public Participant Participant { get; set; } | ||
|
||
[JsonPropertyName("conversationId")] | ||
public string ConversationId { get; set; } | ||
} | ||
|
||
internal sealed class RequestMessage | ||
{ | ||
// Are these needed? | ||
// locale = , | ||
// market = , | ||
// region = , | ||
// location = , | ||
// locationHints: [], | ||
|
||
[JsonPropertyName("timestamp")] | ||
public DateTime Timestamp { get; set; } | ||
|
||
[JsonPropertyName("author")] | ||
public string Author { get; set; } | ||
|
||
[JsonPropertyName("inputMethod")] | ||
public string InputMethod { get; set; } | ||
|
||
[JsonPropertyName("messageType")] | ||
public string MessageType { get; set; } | ||
|
||
[JsonPropertyName("text")] | ||
public string Text { get; set; } | ||
} | ||
|
||
internal struct Participant | ||
{ | ||
[JsonPropertyName("id")] | ||
public string Id { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.