mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-12-04 10:46:27 +00:00
Moved temporary files into a folder of their own below the data directory (#1245)
This commit is contained in:
1 parent
ddfc632b63
commit
12d3e1ec6c
52 files changed
+1219
-396
No files matched your search
@@ -1757,13 +1757,29 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (this.IsTimeoutException(e, token))
|
||||
var isTimeout = this.IsTimeoutException(e, token);
|
||||
if (isTimeout)
|
||||
await this.SendTimeoutError("transcribing audio");
|
||||
|
||||
this.logger.LogError(e, "Failed to perform transcription request: '{Message}'.", e.Message);
|
||||
if (!isTimeout && IsConnectionFailure(e))
|
||||
return TranscriptionResult.Failure(string.Format(TA("AI Studio could not send the media file to the provider '{0}', because the connection to it failed. Please try again."), this.NameForUser));
|
||||
|
||||
return TranscriptionResult.Failure();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether a request failed because the connection failed, before the provider answered.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This holds when the server cannot be reached and when the connection breaks off while the media file is on its
|
||||
/// way, e.g., when the provider closes it. The file has nothing to do with it, and the same file may go through on
|
||||
/// the next try. Without this distinction, the user reads that the provider could not transcribe the file.
|
||||
/// </remarks>
|
||||
/// <param name="exception">What the request threw.</param>
|
||||
/// <returns>True, when the connection failed without an answer of the provider.</returns>
|
||||
internal static bool IsConnectionFailure(Exception exception) => exception is HttpRequestException { StatusCode: null };
|
||||
|
||||
/// <remarks>
|
||||
/// The cancellation token is not the last parameter, unlike everywhere else in this codebase:
|
||||
|
||||
Reference in new issue
Block a user