Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions .github/workflows/release-upload-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,13 @@ jobs:
-Path SampleCSharpUI/bin/Release/* `
-DestinationPath SampleCSharpUI-${{ github.ref_name }}.zip

# Release 作成(タグ名を使用)
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Release を作成または更新し、ZIP を添付
- name: Create or Update Release and Upload ZIP
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false

# ZIP を Release に Upload(ご指定どおり)
- name: Upload ZIP to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: SampleCSharpUI-${{ github.ref_name }}.zip
asset_name: SampleCSharpUI-${{ github.ref_name }}.zip
asset_content_type: application/zip
overwrite_files: true
files: SampleCSharpUI-${{ github.ref_name }}.zip
58 changes: 53 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ Fujitsu Cloud Service Genearative AI Platform の API を利用するための C
実行ファイルはフォルダごとコピーすることでインストール作業なく Windows OS 環境で実行することができます。
実行時の .NET Framework は、Windows 10 / 11 付属のものを利用します。

---
# 使い方
## 起動
1. SampleCSharpUI.exe をクリックして起動
2. 【初回起動時のみ】
自動的にテナント名とクライアントIDを入力する [ 設定 ] 画面を表示するので、利用している Generative AI Platform 環境のテナント名とクライアント ID を入力して [OK] をクリックして保存してください。
3. 自動的にサインインが始まりますので、利用している EntraID の ID とパスワードを入力してください。
4. 「 General Use 」というルームがない場合は、自動的にRAGなしでルームを作成します。
5. 前回利用時のルームの内容を自動的に表示します。初回起動時のみ「 General Use 」ルームが選択されます。
自動的にテナント名とクライアントIDを入力する [ 設定 ] 画面を表示します。
- 利用している Generative AI Platform 環境のテナント名とクライアント ID を入力
- [OK] をクリックして保存してください。
4. [ ログイン ] 画面が表示されるので、[ ログイン ] ボタンをクリックして表示されるブラウザ画面にて、利用している EntraID の ID とパスワードを入力してください。
5. 「 General Use 」というルームがない場合は、自動的にRAGなしでルームを作成します。
6. 前回利用時のルームの内容を自動的に表示します。初回起動時のみ「 General Use 」ルームが選択されます。
- 「 General Use 」ルームは起動時に会話内容が全クリアされる特別なルームです。
- 他のルームは再起動しても会話内容は維持されます。

Expand Down Expand Up @@ -130,14 +133,59 @@ RAG自体を削除したり、RAGに格納されているデータを変更し
マルチモーダル対応は、Cohere v2 Chat 互換 API (/v2/chat)、または、Cohere OpenAI Chat Completions 互換 API (/compatibility/v1/chat/completions) を呼び出すことで実現可能です。
サンプルコードでは、Cohere v2 Chat 互換 API を使用しています。


OpenAI 互換 API、または、Cohere V2 Chat 互換 API を呼び出すことで実現可能です。

---
# サンプルコードの利用 API
サンプルコードでは、Fujitsu Cloud Service Genearative AI Platform が提供する次の API を使用しています。

## 推論関連
推論を実現するための API 呼び出しの為のエンドポイントやリクエストボディ、レスポンスボディの解析などは、 MVVM デザインパターンに基づき、 Models\ChatModel.cs に記載しています。

| 操作 | エンドポイント | 用途 |
| ---- | ---- | ---- |
| GET | /api/v1/chats | チャットルーム一覧取得 |
| POST | /api/v1/chats | チャットルーム作成 |
| PUT | /api/v1/chats/{id} | チャットルーム初期設定 |
| GET | /api/v1/chats/{id}/messages | 会話一覧取得 |
| PUT | /api/v1/chats/{id}/messages | 会話一覧削除 |
| POST | /api/v1/chats/{id}/messages | 入力(プロンプト送信) |
| POST | /api/v1/chats/{id}/messages/createNextAiMessage | LLM から回答受信 |
| GET | /api/v1/chats/{id} | チャットルーム履歴取得 |
| POST | /api/v1/action/defined/text:simple_chat/call | チャットルームなし推論 |
| POST | /api/v1/pass-through/takane/v2/chat | Cohere v2 Chat 互換 API (画像付き入力推論) |

## チャットルーム関連
チャットルームの作成・更新・削除は、 MVVM デザインパターンに基づき、 Models\ChatRoomModel.cs に記載しています。

| 操作 | エンドポイント | 用途 |
| ---- | ---- | ---- |
| GET | /api/v1/chats/{id} | チャットルーム設定取得 |
| PUT | /api/v1/chats/{id} | チャットルーム設定更新 |
| DELETE | /api/v1/chats/{id} | チャットルーム削除 |

## RAG 関連
RAG 関連については、 MVVM デザインパターンに基づき、 Models\RetrieverModel.cs に記載しています。

| 操作 | エンドポイント | 用途 |
| ---- | ---- | ---- |
| GET | /api/v1/retrievers | リトリーバー一覧取得 |
| PUT | /api/v1/retrievers/{id} | リトリーバー取得 |
| POST | /api/v1/retrievers | リトリーバー追加 |
| POST | /api/v1/files/from-url | URL からのファイルアップロード |
| POST | /api/v1/files | ローカルファイルのアップロード |
| POST | /api/v1/retrievers/{id}/process/embeddings | RAGデータ作成 |
| GET | /api/v1/retrievers/{id} | RAGデータ作成完了確認 |
| DELETE | /api/v1/retrievers/{id} | リトリーバー削除 |
| DELETE | /api/v1/retrievers/{id} | リトリーバー削除 |

---
# サンプルコードの build 方法
サンプルコードは、Visual Studio 2026 または、Visual Studio Code を使用して実行ファイルを build できます。
Visual Studio 2026 であれば、SampleCSharpUI.sln を開いていただければ、あとは UI 上で実行や build が可能です。
Visual Studio Code の場合は、環境設定などが必要です。

---
# 最後に
このサンプルが、Fujitsu Cloud Service Generative AI Platform を活用し、皆様のユーザーエクスペリエンスを飛躍的に進化させる革新的なアプリケーションを生み出すためのインスピレーションとなれば幸いです。
さらに、本サンプルではチャットや RAG の管理においても操作性を追求した実装をアプリ側で行っていますので、皆様が開発されるアプリの管理画面設計のヒントとしてぜひご活用ください。
18 changes: 11 additions & 7 deletions SampleCSharpUI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.9" newVersion="10.0.0.9" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
Expand All @@ -23,31 +23,35 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.9" newVersion="10.0.0.9" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.9" newVersion="10.0.0.9" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.9" newVersion="10.0.0.9" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.TimeProvider" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.9" newVersion="10.0.0.9" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Formats.Asn1" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.9" newVersion="10.0.0.9" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.15.0.0" newVersion="8.15.0.0" />
<bindingRedirect oldVersion="0.0.0.0-8.19.1.0" newVersion="8.19.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.Cryptography" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.9" newVersion="10.0.0.9" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
2 changes: 1 addition & 1 deletion SampleCSharpUI/Converters/Boolean2CollapsedConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SampleCSharpUI.Converters
{
internal class Boolean2CollapsedConverter : IValueConverter
public class Boolean2CollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
2 changes: 1 addition & 1 deletion SampleCSharpUI/Converters/Boolean2VisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SampleCSharpUI.Converters
{
internal class Boolean2VisibilityConverter : IValueConverter
public class Boolean2VisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
2 changes: 1 addition & 1 deletion SampleCSharpUI/Converters/Null2CollapsedConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace SampleCSharpUI.Converters
{
internal class Null2CollapsedConverter : IValueConverter
public class Null2CollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
2 changes: 1 addition & 1 deletion SampleCSharpUI/Converters/Null2FalseConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace SampleCSharpUI.Converters
{
internal class Null2FalseConverter : IValueConverter
public class Null2FalseConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SampleCSharpUI.Converters
{
internal class RoleToHorizontalAlignmentConverter : IValueConverter
public class RoleToHorizontalAlignmentConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand All @@ -16,7 +16,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
}
else
{
return Visibility.Collapsed;
return HorizontalAlignment.Left;
}
}

Expand Down
Loading
Loading