mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 00:57:59 +00:00
Added tool calling support (#731)
Co-authored-by: krut_ni <nils.kruthoff@dlr.de> Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
266 files changed
+11186
-740
No files matched your search
@@ -44,7 +44,7 @@ public sealed partial class VisualBriefingStore
|
||||
: VisualBriefingBuildStatus.ACTIVE;
|
||||
matching.Failure = null;
|
||||
matching.UpdatedAtUtc = DateTimeOffset.UtcNow;
|
||||
await this.StoreBuildAtomicAsync(matching, token);
|
||||
await this.StoreBuildAtomicAsync(matching, overwrite: true, token);
|
||||
return (matching, true);
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ public sealed partial class VisualBriefingStore
|
||||
{
|
||||
stale.Status = VisualBriefingBuildStatus.SUPERSEDED;
|
||||
stale.UpdatedAtUtc = DateTimeOffset.UtcNow;
|
||||
await this.StoreBuildAtomicAsync(stale, token);
|
||||
await this.StoreBuildAtomicAsync(stale, overwrite: true, token);
|
||||
}
|
||||
|
||||
await this.StoreBuildAtomicAsync(candidate, token, overwrite: false);
|
||||
await this.StoreBuildAtomicAsync(candidate, overwrite: false, token);
|
||||
return (candidate, false);
|
||||
}
|
||||
finally
|
||||
@@ -81,7 +81,7 @@ public sealed partial class VisualBriefingStore
|
||||
|
||||
try
|
||||
{
|
||||
await this.StoreBuildAtomicAsync(build, token);
|
||||
await this.StoreBuildAtomicAsync(build, overwrite: true, token);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -372,12 +372,11 @@ public sealed partial class VisualBriefingStore
|
||||
/// Writes one build record atomically.
|
||||
/// </summary>
|
||||
/// <param name="build">The build record.</param>
|
||||
/// <param name="token">The cancellation token.</param>
|
||||
/// <param name="overwrite">Whether an existing record may be replaced.</param>
|
||||
private async Task StoreBuildAtomicAsync(
|
||||
VisualBriefingBuildRecord build,
|
||||
CancellationToken token,
|
||||
bool overwrite = true)
|
||||
/// <param name="token">The cancellation token.</param>
|
||||
private async Task StoreBuildAtomicAsync(VisualBriefingBuildRecord build,
|
||||
bool overwrite,
|
||||
CancellationToken token)
|
||||
{
|
||||
if (build.BuildVersion != VisualBriefingVersions.BUILD ||
|
||||
build.BuildId == Guid.Empty ||
|
||||
@@ -386,7 +385,7 @@ public sealed partial class VisualBriefingStore
|
||||
throw new InvalidDataException("The visual briefing build record is invalid.");
|
||||
|
||||
var json = JsonSerializer.Serialize(build, JSON_OPTIONS);
|
||||
await WriteTextAtomicAsync(this.BuildPath(build.BriefingId, build.BuildId), json, token, overwrite);
|
||||
await WriteTextAtomicAsync(this.BuildPath(build.BriefingId, build.BuildId), json, overwrite, token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -22,7 +22,7 @@ public sealed partial class VisualBriefingStore
|
||||
try
|
||||
{
|
||||
this.LastSelectedBriefingId = briefingId;
|
||||
await WriteTextAtomicAsync(this.SelectionPath(), JsonSerializer.Serialize<Guid?>(briefingId), token);
|
||||
await WriteTextAtomicAsync(this.SelectionPath(), JsonSerializer.Serialize<Guid?>(briefingId), overwrite: true, token);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -45,7 +45,7 @@ public sealed partial class VisualBriefingStore
|
||||
return;
|
||||
|
||||
this.LastSelectedBriefingId = null;
|
||||
await WriteTextAtomicAsync(this.SelectionPath(), JsonSerializer.Serialize<Guid?>(null), token);
|
||||
await WriteTextAtomicAsync(this.SelectionPath(), JsonSerializer.Serialize<Guid?>(null), overwrite: true, token);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -456,7 +456,7 @@ public sealed partial class VisualBriefingStore
|
||||
private async Task StoreManifestAtomicAsync(VisualBriefingManifest manifest, CancellationToken token)
|
||||
{
|
||||
var json = JsonSerializer.Serialize(manifest, JSON_OPTIONS);
|
||||
await WriteTextAtomicAsync(this.ManifestPath(manifest.BriefingId), json, token);
|
||||
await WriteTextAtomicAsync(this.ManifestPath(manifest.BriefingId), json, overwrite: true, token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -59,7 +59,7 @@ public sealed partial class VisualBriefingStore
|
||||
committedBuild.Failure = null;
|
||||
committedBuild.UpdatedAtUtc = DateTimeOffset.UtcNow;
|
||||
|
||||
await this.StoreBuildAtomicAsync(committedBuild, token);
|
||||
await this.StoreBuildAtomicAsync(committedBuild, overwrite: true, token);
|
||||
}
|
||||
|
||||
foreach (var interruptedBuild in builds.Where(build => build.Status is VisualBriefingBuildStatus.ACTIVE))
|
||||
@@ -99,7 +99,7 @@ public sealed partial class VisualBriefingStore
|
||||
interruptedBuild.Status = VisualBriefingBuildStatus.FAILED;
|
||||
interruptedBuild.Failure = interruptedFailure;
|
||||
interruptedBuild.UpdatedAtUtc = DateTimeOffset.UtcNow;
|
||||
await this.StoreBuildAtomicAsync(interruptedBuild, token);
|
||||
await this.StoreBuildAtomicAsync(interruptedBuild, overwrite: true, token);
|
||||
}
|
||||
|
||||
var changed = manifest.Versions.RemoveAll(version =>
|
||||
@@ -166,7 +166,7 @@ public sealed partial class VisualBriefingStore
|
||||
matchingBuild.Status = VisualBriefingBuildStatus.COMPLETED;
|
||||
matchingBuild.Failure = null;
|
||||
matchingBuild.UpdatedAtUtc = DateTimeOffset.UtcNow;
|
||||
await this.StoreBuildAtomicAsync(matchingBuild, token);
|
||||
await this.StoreBuildAtomicAsync(matchingBuild, overwrite: true, token);
|
||||
}
|
||||
|
||||
changed = true;
|
||||
|
||||
@@ -85,7 +85,7 @@ public sealed partial class VisualBriefingStore
|
||||
var source = manifest.Sources.FirstOrDefault(candidate => candidate.SourceId == sourceId)
|
||||
?? throw new InvalidOperationException("The media source does not exist in this briefing.");
|
||||
var transcriptPath = this.TranscriptPath(briefingId, source.SourceId);
|
||||
await WriteTextAtomicAsync(transcriptPath, transcript, token);
|
||||
await WriteTextAtomicAsync(transcriptPath, transcript, overwrite: true, token);
|
||||
source.TranscriptStatus = VisualBriefingTranscriptStatus.CURRENT;
|
||||
ApplyFileSnapshot(source, source.Path);
|
||||
manifest.ModifiedAtUtc = DateTimeOffset.UtcNow;
|
||||
|
||||
@@ -132,8 +132,7 @@ public sealed partial class VisualBriefingStore
|
||||
await WriteTextAtomicAsync(
|
||||
Path.Combine(this.VersionsDirectory(manifest.BriefingId), version.FileName),
|
||||
html,
|
||||
token,
|
||||
overwrite: false);
|
||||
overwrite: false, token);
|
||||
|
||||
manifest.Versions.Add(version);
|
||||
if (request.EditMode is not (VisualBriefingEditMode.CHANGE_DESIGN or VisualBriefingEditMode.RECOMPILE))
|
||||
@@ -357,7 +356,7 @@ public sealed partial class VisualBriefingStore
|
||||
var storedVersion = await this.OpenIntegrityCheckedVersionAsync(existing.BriefingId, knownRevision.RevisionId, token);
|
||||
if (storedVersion is null)
|
||||
{
|
||||
await WriteTextAtomicAsync(this.VersionPath(existing.BriefingId, knownRevision), html, token);
|
||||
await WriteTextAtomicAsync(this.VersionPath(existing.BriefingId, knownRevision), html, overwrite: true, token);
|
||||
var restoredHashes = ComputeSectionHashes(parts);
|
||||
knownRevision.DataHash = restoredHashes.DataHash;
|
||||
knownRevision.AssetHash = restoredHashes.AssetHash;
|
||||
@@ -415,8 +414,7 @@ public sealed partial class VisualBriefingStore
|
||||
await WriteTextAtomicAsync(
|
||||
Path.Combine(this.VersionsDirectory(existing.BriefingId), version.FileName),
|
||||
html,
|
||||
token,
|
||||
overwrite: false);
|
||||
overwrite: false, token);
|
||||
|
||||
existing.Versions.Add(version);
|
||||
existing.ModifiedAtUtc = DateTimeOffset.UtcNow;
|
||||
|
||||
@@ -107,17 +107,16 @@ public sealed partial class VisualBriefingStore(
|
||||
string json,
|
||||
CancellationToken token)
|
||||
{
|
||||
await WriteTextAtomicAsync(path, json, token, overwrite: false);
|
||||
await WriteTextAtomicAsync(path, json, overwrite: false, token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines <c>WriteTextAtomicAsync</c> for the visual briefing feature.
|
||||
/// </summary>
|
||||
private static async Task WriteTextAtomicAsync(
|
||||
string targetPath,
|
||||
private static async Task WriteTextAtomicAsync(string targetPath,
|
||||
string content,
|
||||
CancellationToken token,
|
||||
bool overwrite = true)
|
||||
bool overwrite,
|
||||
CancellationToken token)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(targetPath)!);
|
||||
var temporaryPath = $"{targetPath}.tmp-{Guid.NewGuid():N}";
|
||||
|
||||
Reference in new issue
Block a user