Skip to content

Commit 53471c9

Browse files
committed
Update Unity version and refactor
1 parent 4c66c3f commit 53471c9

39 files changed

+180
-224
lines changed

Assets/Mochineko/Whisper_API.Samples/Transcription.meta

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

Assets/Mochineko/Whisper_API.Samples/Transcription/TranscriptionSample.cs renamed to Assets/Mochineko/Whisper_API.Samples/TranscriptionSample.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using UnityEngine;
55
using UnityEngine.Assertions;
66

7-
namespace Mochineko.Whisper_API.Transcription.Samples
7+
namespace Mochineko.Whisper_API.Samples
88
{
99
/// <summary>
1010
/// A sample component to transcribe speech into text by Whisper transcription API on Unity.
@@ -21,15 +21,15 @@ public sealed class TranscriptionSample : MonoBehaviour
2121
/// </summary>
2222
[SerializeField] private string filePath = string.Empty;
2323

24-
private WhisperTranscriptionConnection? connection;
24+
private Transcription? connection;
2525

2626
private void Start()
2727
{
2828
// API Key must be set.
2929
Assert.IsNotNull(apiKey);
3030

3131
// Create instance of WhisperTranscriptionConnection.
32-
connection = new WhisperTranscriptionConnection(apiKey);
32+
connection = new Transcription(apiKey);
3333

3434
// If you want to specify response format, language, etc..., please use other initialization:
3535
// connection = new WhisperTranscriptionConnection(apiKey, new APIRequestBody(
@@ -72,7 +72,7 @@ public async void Transcribe()
7272
}
7373

7474
// Default text response format is JSON.
75-
var text = APIResponseBody.FromJson(result)?.Text;
75+
var text = TranscriptionResponseBody.FromJson(result)?.Text;
7676

7777
// Log text result.
7878
Debug.Log($"[Whisper_API.Transcription.Samples] Result:\n{text}");

Assets/Mochineko/Whisper_API.Samples/Translation.meta

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

Assets/Mochineko/Whisper_API.Samples/Translation/TranslationSample.cs renamed to Assets/Mochineko/Whisper_API.Samples/TranslationSample.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using UnityEngine;
55
using UnityEngine.Assertions;
66

7-
namespace Mochineko.Whisper_API.Translation.Samples
7+
namespace Mochineko.Whisper_API.Samples
88
{
99
/// <summary>
1010
/// A sample component to translate speech into English text by Whisper transcription API on Unity.
@@ -21,15 +21,15 @@ public sealed class TranslationSample : MonoBehaviour
2121
/// </summary>
2222
[SerializeField] private string filePath = string.Empty;
2323

24-
private WhisperTranslationConnection? connection;
24+
private Translation? connection;
2525

2626
private void Start()
2727
{
2828
// API Key must be set.
2929
Assert.IsNotNull(apiKey);
3030

3131
// Create instance of WhisperTranscriptionConnection.
32-
connection = new WhisperTranslationConnection(apiKey);
32+
connection = new Translation(apiKey);
3333

3434
// If you want to specify response format, etc..., please use other initialization:
3535
// connection = new WhisperTranslationConnection(apiKey, new APIRequestBody(
@@ -71,7 +71,7 @@ public async void Translate()
7171
}
7272

7373
// Default text response format is JSON.
74-
var text = APIResponseBody.FromJson(result)?.Text;
74+
var text = TranslationResponseBody.FromJson(result)?.Text;
7575

7676
// Log text result.
7777
Debug.Log($"[Whisper_API.Translation.Samples] Result:\n{text}");

Assets/Mochineko/Whisper_API.Tests/Transcription.meta

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

Assets/Mochineko/Whisper_API.Tests/Transcription/TranscriptionTest.cs renamed to Assets/Mochineko/Whisper_API.Tests/TranscriptionTest.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
using System.Threading;
44
using System.Threading.Tasks;
55
using FluentAssertions;
6-
using Mochineko.Whisper_API.Transcription;
76
using NUnit.Framework;
87
using UnityEngine;
98
using UnityEngine.TestTools;
10-
using APIResponseBody = Mochineko.Whisper_API.Transcription.APIResponseBody;
119

12-
namespace Mochineko.Whisper_API.Transcription.Tests
10+
namespace Mochineko.Whisper_API.Tests
1311
{
1412
[TestFixture]
1513
internal sealed class TranscriptionTest
@@ -29,13 +27,13 @@ public async Task Transcribe()
2927
Application.dataPath,
3028
"Mochineko/Whisper_API.Tests/test.wav");
3129

32-
var connection = new WhisperTranscriptionConnection(apiKey, Model.Whisper1);
30+
var connection = new Transcription(apiKey, Model.Whisper1);
3331

3432
var result = await connection.TranscribeFromFileAsync(filePath, CancellationToken.None);
3533

3634
string.IsNullOrEmpty(result).Should().BeFalse();
3735

38-
var json = APIResponseBody.FromJson(result);
36+
var json = TranscriptionResponseBody.FromJson(result);
3937

4038
Debug.Log($"Result:\n{json?.Text}");
4139
}

Assets/Mochineko/Whisper_API.Tests/Translation.meta

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

0 commit comments

Comments
 (0)