Skip to content

Commit

Permalink
3.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
karamem0 committed Oct 15, 2024
1 parent 7700056 commit 9d98eb6
Show file tree
Hide file tree
Showing 19 changed files with 523 additions and 279 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
deploy-development:
if: github.ref == 'refs/heads/develop'
uses: ./.github/workflows/workflow.deploy.yml
uses: ./.github/workflows/deploy.yml
secrets:
APP_CLIENT_ID: ${{secrets.APP_CLIENT_ID}}
APP_DOMAIN_NAME: ${{secrets.APP_DOMAIN_NAME}}
Expand All @@ -23,7 +23,7 @@ jobs:
environment: development
deploy-production:
if: github.ref == 'refs/heads/main'
uses: ./.github/workflows/workflow.deploy.yml
uses: ./.github/workflows/deploy.yml
secrets:
APP_CLIENT_ID: ${{secrets.APP_CLIENT_ID}}
APP_DOMAIN_NAME: ${{secrets.APP_DOMAIN_NAME}}
Expand All @@ -37,7 +37,7 @@ jobs:
environment: production
create-release:
if: contains(github.ref, 'refs/tags/')
uses: ./.github/workflows/workflow.release.yml
uses: ./.github/workflows/release.yml
secrets:
APP_CLIENT_ID: ${{secrets.APP_CLIENT_ID}}
APP_DOMAIN_NAME: ${{secrets.APP_DOMAIN_NAME}}
Expand Down
28 changes: 8 additions & 20 deletions source/server/Karamem0.Commistant.Bot/Bots/ActivityBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,15 @@ protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivi
{
if (dc.ActiveDialog is null)
{
var result = await new Func<Task<DialogTurnResult?>>(async () =>
var arguments = await this.openAIService.GetArgumentsAsync(command, cancellationToken: cancellationToken);
var result = arguments?.Type switch
{
var message = await this.openAIService.ChatCompletionAsync(command, cancellationToken: cancellationToken);
if (message.FinishReason == ChatFinishReason.ToolCalls)
{
var arguments = message.ToolCalls.Select(item => item.FunctionArguments).First();
var content = JsonSerializer.Deserialize<ConversationPropertyArguments>(arguments?.ToString());
return content?.Type switch
{
"会議開始後" => await dc.BeginDialogAsync(nameof(StartMeetingDialog), content, cancellationToken: cancellationToken),
"会議終了前" => await dc.BeginDialogAsync(nameof(EndMeetingDialog), content, cancellationToken: cancellationToken),
"会議中" => await dc.BeginDialogAsync(nameof(InMeetingDialog), content, cancellationToken: cancellationToken),
"初期化" => await dc.BeginDialogAsync(nameof(ResetDialog), cancellationToken: cancellationToken),
_ => null,
};
}
else
{
return null;
}
})();
"会議開始後" => await dc.BeginDialogAsync(nameof(StartMeetingDialog), arguments, cancellationToken: cancellationToken),
"会議終了前" => await dc.BeginDialogAsync(nameof(EndMeetingDialog), arguments, cancellationToken: cancellationToken),
"会議中" => await dc.BeginDialogAsync(nameof(InMeetingDialog), arguments, cancellationToken: cancellationToken),
"初期化" => await dc.BeginDialogAsync(nameof(ResetDialog), cancellationToken: cancellationToken),
_ => null,
};
if (result is null)
{
_ = await turnContext.SendActivityAsync(
Expand Down
126 changes: 94 additions & 32 deletions source/server/Karamem0.Commistant.Bot/Dialogs/EndMeetingDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ private async Task<DialogTurnResult> BeforeConfirmAsync(WaterfallStepContext ste
new AdaptiveTextInput()
{
Id = "Message",
IsMultiline = true,
Label = "メッセージ",
Placeholder = "会議後に表示されるメッセージ",
Style = AdaptiveTextInputStyle.Text,
Expand Down Expand Up @@ -172,76 +173,137 @@ private async Task<DialogTurnResult> AfterConrifmAsync(WaterfallStepContext step
property.EndMeetingMessage = value.Value<string>("Message", null);
property.EndMeetingUrl = value.Value<string>("Url", null);
this.logger.SettingsUpdated(stepContext.Context.Activity);
_ = await stepContext.Context.SendActivityAsync(
"設定を変更しました。",
cancellationToken: cancellationToken
);
_ = await stepContext.Context.SendSettingsUpdatedAsync(cancellationToken);
}
if (value.Value<string>("Button") == "Cancel")
{
this.logger.SettingsCancelled(stepContext.Context.Activity);
_ = await stepContext.Context.SendActivityAsync(
"キャンセルしました。設定は変更されていません。",
cancellationToken: cancellationToken
);
_ = await stepContext.Context.SendSettingsCancelledAsync(cancellationToken);
}
if (stepContext.Context.Activity.ReplyToId is not null)
{
var card = new AdaptiveCard("1.3")
{
Body =
[
new AdaptiveFactSet()
new AdaptiveColumnSet()
{
Facts =
Columns =
[
new()
new AdaptiveColumn()
{
Title = "スケジュール",
Value = new Func<string>(() =>
property.EndMeetingSchedule switch
Items =
[
new AdaptiveTextBlock()
{
-1 => "なし",
0 => "予定時刻",
_ => $"{property.EndMeetingSchedule} 分後"
Text = "スケジュール",
Weight = AdaptiveTextWeight.Bolder
}
)()
],
Width = "90px"
},
new()
new AdaptiveColumn()
{
Title = "メッセージ",
Value = $"{property.EndMeetingMessage}"
Items =
[
new AdaptiveTextBlock()
{
Text = property.EndMeetingSchedule switch
{
-1 => "なし",
0 => "予定時刻",
_ => $"{property.EndMeetingSchedule} 分前"
}
}
],
Width = "stretch"
}
],
},
new AdaptiveColumnSet()
{
Columns =
[
new AdaptiveColumn()
{
Items =
[
new AdaptiveTextBlock()
{
Text = "メッセージ",
Weight = AdaptiveTextWeight.Bolder
}
],
Width = "90px"
},
new()
new AdaptiveColumn()
{
Title = "URL",
Value = $"{property.EndMeetingUrl}"
Items =
[
new AdaptiveTextBlock()
{
Text = $"{property.EndMeetingMessage}",
Wrap = true
}
],
Width = "stretch"
}
]
},
new AdaptiveColumnSet()
{
Columns =
[
new AdaptiveColumn()
{
Items =
[
new AdaptiveTextBlock()
{
Text = "URL",
Weight = AdaptiveTextWeight.Bolder
}
],
Width = "90px"
},
new AdaptiveColumn()
{
Items =
[
new AdaptiveTextBlock()
{
Text = $"{property.EndMeetingUrl}"
}
],
Width = "stretch"
}
]
}
]
};
if (property.EndMeetingUrl is not null)
if (Uri.TryCreate(property.EndMeetingUrl, UriKind.Absolute, out var url))
{
var bytes = await this.qrCodeService.CreateAsync(property.EndMeetingUrl, cancellationToken);
var bytes = await this.qrCodeService.CreateAsync(url.ToString(), cancellationToken);
var base64 = Convert.ToBase64String(bytes);
card.Body.Add(new AdaptiveImage()
{
AltText = property.EndMeetingUrl,
Size = AdaptiveImageSize.Stretch,
AltText = url.ToString(),
Size = AdaptiveImageSize.Large,
Url = new Uri($"data:image/png;base64,{base64}")
});
card.Actions.Add(new AdaptiveOpenUrlAction()
{
Title = "URL を開く",
Url = url,
});
}
var activity = MessageFactory.Attachment(new Attachment()
{
ContentType = AdaptiveCard.ContentType,
Content = JsonConvert.DeserializeObject(card.ToJson())
});
activity.Id = stepContext.Context.Activity.ReplyToId;
_ = await stepContext.Context.UpdateActivityAsync(
activity,
cancellationToken: cancellationToken
);
_ = await stepContext.Context.UpdateActivityAsync(activity, cancellationToken);
}
return await stepContext.EndDialogAsync(cancellationToken: cancellationToken);
}
Expand Down
Loading

0 comments on commit 9d98eb6

Please sign in to comment.