...
This commit is contained in:
@@ -93,9 +93,6 @@
|
||||
<source src="@GetAudioDataUrl(msg.FileType, msg.FileContent)" type="@msg.FileType">
|
||||
مرورگر شما از پخش صدا پشتیبانی نمیکند.
|
||||
</audio>
|
||||
<div class="audio-info">
|
||||
<small class="text-muted">@GetAudioDuration(msg.FileContent)</small>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (!string.IsNullOrWhiteSpace(msg.text))
|
||||
@@ -302,7 +299,7 @@
|
||||
value += "/" + CompanyGroups.FirstOrDefault(f => f.ID == GroupID.GetValueOrDefault()).Name;
|
||||
|
||||
}
|
||||
if (LastOpenChat != null)
|
||||
if (LastOpenChat != null && LastOpenChat.Responses!=null)
|
||||
{
|
||||
var model = LastOpenChat.Responses.OrderBy(o => o.ID).LastOrDefault(l => l.Type != Common.Enums.ConversationType.UE);
|
||||
|
||||
@@ -407,18 +404,6 @@
|
||||
? string.Empty
|
||||
: $"data:{fileType};base64,{Convert.ToBase64String(content)}";
|
||||
|
||||
private string GetAudioDuration(byte[]? content)
|
||||
{
|
||||
// Simple duration calculation based on file size (approximate)
|
||||
if (content == null || content.Length == 0) return "00:00";
|
||||
|
||||
// Assuming 16-bit PCM at 44.1kHz, mono
|
||||
var bytesPerSecond = 44100 * 2; // 44.1kHz * 2 bytes per sample
|
||||
var durationSeconds = content.Length / bytesPerSecond;
|
||||
var minutes = durationSeconds / 60;
|
||||
var seconds = durationSeconds % 60;
|
||||
return $"{minutes:D2}:{seconds:D2}";
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
async Task OnClickSendMsg()
|
||||
|
Reference in New Issue
Block a user