Skip to content

Commit be0ae37

Browse files
Merge pull request #314 from selfdocumentingcode/feature/gpt-images
Feature/gpt images
2 parents 044c7f1 + 7d0f81c commit be0ae37

37 files changed

Lines changed: 1012 additions & 773 deletions

.editorconfig

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ max_line_length = 120
1515
end_of_line = crlf
1616
insert_final_newline = true
1717

18-
# Visual Studio
18+
# Visual Studio
1919
csharp_style_namespace_declarations = file_scoped # Use file scoped namespace by default for new class files
2020

2121
### Naming styles ###
@@ -46,11 +46,11 @@ dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = stat
4646

4747
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
4848
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
49-
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
49+
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
5050

5151
dotnet_naming_symbols.local.applicable_kinds = local
5252
dotnet_naming_symbols.local.applicable_accessibilities = local
53-
dotnet_naming_symbols.local.required_modifiers =
53+
dotnet_naming_symbols.local.required_modifiers =
5454

5555
dotnet_naming_symbols.constant_field.applicable_kinds = field
5656
dotnet_naming_symbols.constant_field.applicable_accessibilities = *
@@ -59,18 +59,18 @@ dotnet_naming_symbols.constant_field.required_modifiers = const
5959
# Naming styles
6060

6161
dotnet_naming_style._fieldname.required_prefix = _
62-
dotnet_naming_style._fieldname.required_suffix =
63-
dotnet_naming_style._fieldname.word_separator =
62+
dotnet_naming_style._fieldname.required_suffix =
63+
dotnet_naming_style._fieldname.word_separator =
6464
dotnet_naming_style._fieldname.capitalization = camel_case
6565

66-
dotnet_naming_style.camelcase.required_prefix =
67-
dotnet_naming_style.camelcase.required_suffix =
68-
dotnet_naming_style.camelcase.word_separator =
66+
dotnet_naming_style.camelcase.required_prefix =
67+
dotnet_naming_style.camelcase.required_suffix =
68+
dotnet_naming_style.camelcase.word_separator =
6969
dotnet_naming_style.camelcase.capitalization = camel_case
7070

71-
dotnet_naming_style.pascal_case.required_prefix =
72-
dotnet_naming_style.pascal_case.required_suffix =
73-
dotnet_naming_style.pascal_case.word_separator =
71+
dotnet_naming_style.pascal_case.required_prefix =
72+
dotnet_naming_style.pascal_case.required_suffix =
73+
dotnet_naming_style.pascal_case.word_separator =
7474
dotnet_naming_style.pascal_case.capitalization = pascal_case
7575

7676
### Stylecop rules ###
@@ -87,6 +87,7 @@ dotnet_diagnostic.sa1101.severity = none # Prefix local calls with this
8787
dotnet_diagnostic.sa1200.severity = none # Using directive should appear within a namespace declaration
8888
dotnet_diagnostic.sa1201.severity = suggestion # Elements should appear in the correct order
8989
dotnet_diagnostic.sa1202.severity = suggestion # Elements should be ordered by access
90+
dotnet_diagnostic.sa1204.severity = suggestion # Static members should appear before non-static members
9091

9192
# Naming
9293

@@ -102,13 +103,16 @@ dotnet_diagnostic.sa1402.severity = suggestion # File may only contain a single
102103
dotnet_diagnostic.sa1502.severity = none # Element should not be on a single line
103104
dotnet_diagnostic.sa1503.severity = none # Braces should not be omitted
104105
dotnet_diagnostic.sa1515.severity = suggestion # Single-line comment should be preceded by blank line
106+
105107
# Documentation
106108

107109
dotnet_diagnostic.sa1600.severity = none # Elements should be documented
108110
dotnet_diagnostic.sa1601.severity = none # Partial elements should be documented
109111
dotnet_diagnostic.sa1602.severity = none # Enumeration items should be documented
110112
dotnet_diagnostic.sa1611.severity = none # Element parameter should be documented
111113
dotnet_diagnostic.sa1615.severity = none # Element return value should be documented
114+
dotnet_diagnostic.sa1623.severity = none # The property's documentation summary text should begin with: 'Gets or sets'
115+
dotnet_diagnostic.sa1629.severity = none # Documentation text should end with a period
112116
dotnet_diagnostic.sa1633.severity = none # File should have header
113117
dotnet_diagnostic.sa1649.severity = none # File name should match first type name
114118

@@ -186,7 +190,7 @@ resharper_csharp_wrap_extends_list_style = chop_always
186190
resharper_csharp_wrap_parameters_style = chop_if_long
187191
resharper_for_built_in_types = use_var_when_evident
188192
resharper_for_other_types = use_var_when_evident
189-
resharper_instance_members_qualify_declared_in =
193+
resharper_instance_members_qualify_declared_in =
190194
resharper_keep_existing_embedded_block_arrangement = false
191195
resharper_keep_existing_enum_arrangement = false
192196
resharper_nested_ternary_style = expanded

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
workflow: GitHubFlow/v1
1+
workflow: TrunkBased/preview1
22
assembly-informational-format: '{FullSemVer}'
33
major-version-bump-message: "^(build|chore|ci|docs|feat|feature|fix|bug|bugfix|perf|refactor|revert|style|test)(\\([\\w\\s-,/\\\\]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)"
44
minor-version-bump-message: "^(feat|feature)(\\([\\w\\s-,/\\\\]*\\))?(:|/)"

docker/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ services:
55
build:
66
context: ..
77
dockerfile: src/Kattbot/Dockerfile
8+
tty: true
89
environment:
910
- DOTNET_ENVIRONMENT=Development
1011
env_file:

src/Kattbot.Common/Models/KattGpt/ChatCompletionCreateRequest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@ public record ChatCompletionCreateRequest
2525
/// <summary>
2626
/// A list of tools the model may call. Currently, only functions are supported as a tool.
2727
/// Use this to provide a list of functions the model may generate JSON inputs for.
28-
/// A max of 128 functions are supported.
28+
/// A max of 128 functions is supported.
2929
/// https://platform.openai.com/docs/api-reference/chat/create#chat-create-tools
3030
/// </summary>
3131
[JsonPropertyName("tools")]
3232
public ChatCompletionTool[]? Tools { get; set; }
3333

3434
/// <summary>
3535
/// Controls which (if any) tool is called by the model.
36-
/// none means the model will not call any tool and instead generates a message.
37-
/// auto means the model can pick between generating a message or calling one or more tools.
38-
/// required means the model must call one or more tools.
36+
/// - "none" means the model will not call any tool and instead generates a message.
37+
/// - "auto" means the model can pick between generating a message or calling one or more tools.
38+
/// - "required" means the model must call one or more tools.
3939
/// Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}}
4040
/// forces the model to call that tool.
41-
/// none is the default when no tools are present. auto is the default if tools are present.
41+
/// "none" is the default when no tools are present. "auto" is the default if tools are present.
4242
/// https://platform.openai.com/docs/api-reference/chat/create#chat-create-tool_choice
4343
/// </summary>
4444
[JsonPropertyName("tool_choice")]
45-
public StringOrObject<ChatCompletionToolChoice> ToolChoice { get; set; }
45+
public StringOrObject<ChatCompletionToolChoice>? ToolChoice { get; set; }
4646

4747
/// <summary>
4848
/// Whether to enable parallel function calling during tool use.
@@ -135,4 +135,4 @@ public record ChatCompletionCreateRequest
135135
/// </summary>
136136
[JsonPropertyName("user")]
137137
public string? User { get; set; }
138-
}
138+
}

src/Kattbot.Data/Repositories/EmotesRepository.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ public async Task RemoveEmoteEntity(EmoteEntity emote)
4141
await _dbContext.SaveChangesAsync();
4242
}
4343

44-
public Task<EmoteEntity> GetExistingEntity(EmoteEntity entity)
44+
private Task<EmoteEntity?> GetExistingEntity(EmoteEntity entity)
4545
{
4646
Task<EmoteEntity?> emote = _dbContext.Emotes.AsQueryable()
47-
.Where(
48-
e => e.EmoteId == entity.EmoteId
49-
&& e.MessageId == entity.MessageId
50-
&& e.UserId == entity.UserId
51-
&& e.GuildId == entity.GuildId)
47+
.Where(e => e.EmoteId == entity.EmoteId
48+
&& e.MessageId == entity.MessageId
49+
&& e.UserId == entity.UserId
50+
&& e.GuildId == entity.GuildId)
5251
.FirstOrDefaultAsync();
5352

5453
return emote;

src/Kattbot/Attributes/RequireOwnerOrFriend.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public override async Task<bool> ExecuteCheckAsync(CommandContext ctx, bool help
2727

2828
DiscordApplication botApp = ctx.Client.CurrentApplication;
2929

30-
bool isBotOwner = botApp.Owners.Any(x => x.Id == userId);
30+
bool isBotOwner = botApp.Owners?.Any(x => x.Id == userId) ?? false;
3131

3232
if (isBotOwner)
3333
{

src/Kattbot/CommandHandlers/Images/DallePrompt.cs

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/Kattbot/CommandHandlers/Images/DallifyImageBase.cs

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/Kattbot/CommandHandlers/Images/DallifyImageEmote.cs

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)