mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 20:07:20 +00:00
Upgraded to .NET 10 (#1147)
This commit is contained in:
1 parent
faae2951f7
commit
fc7399e81b
327 files changed
+3059
-3049
No files matched your search
@@ -24,13 +24,13 @@ public sealed class RetrievalContextSourcesTests
|
||||
referenceTitle: "handbook.pdf (Page 12)",
|
||||
referenceLink: $"{new Uri(AbsolutePath("handbook.pdf")).AbsoluteUri}#page=12").ToSources();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(sources, Has.Count.EqualTo(1));
|
||||
Assert.That(sources[0].Title, Is.EqualTo("handbook.pdf (Page 12)"));
|
||||
Assert.That(sources[0].URL, Does.EndWith("#page=12"), "The page is what opens the document where the passage is.");
|
||||
Assert.That(sources[0].Origin, Is.EqualTo(SourceOrigin.RAG));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -40,12 +40,12 @@ public sealed class RetrievalContextSourcesTests
|
||||
|
||||
var sources = TextContext(path: path).ToSources();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(sources, Has.Count.EqualTo(1));
|
||||
Assert.That(sources[0].Title, Is.EqualTo("Handbooks"));
|
||||
Assert.That(sources[0].URL, Is.EqualTo(new Uri(path).AbsoluteUri), "A file becomes a link which opens it.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -53,13 +53,13 @@ public sealed class RetrievalContextSourcesTests
|
||||
{
|
||||
var sources = TextContext(path: Path.Combine("docs", "handbook.pdf")).ToSources();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(sources, Has.Count.EqualTo(1), "The AI received the passage, so it needs a source to be read at.");
|
||||
Assert.That(sources[0].Title, Is.EqualTo("Handbooks"));
|
||||
Assert.That(sources[0].HasNoLink(), Is.True, "A relative path would point somewhere else depending on where it is opened from.");
|
||||
Assert.That(sources[0].TryGetDocumentLocation(out _), Is.False);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -67,11 +67,11 @@ public sealed class RetrievalContextSourcesTests
|
||||
{
|
||||
var sources = TextContext(path: "db://collection/42").ToSources();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(sources, Has.Count.EqualTo(1));
|
||||
Assert.That(sources[0].HasNoLink(), Is.True, "An ERI server may name its content in a way no program here can open.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -98,11 +98,11 @@ public sealed class RetrievalContextSourcesTests
|
||||
{
|
||||
var sources = TextContext(path: string.Empty, links: ["javascript:alert(1)", "mailto:team@example.org", "https://example.org/wiki/mixing-console"]).ToSources();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(sources.Select(source => source.URL), Is.EqualTo(new[] { "https://example.org/wiki/mixing-console" }), "An ERI server decides which links it sends, and a script is no source.");
|
||||
Assert.That(sources[0].Title, Is.EqualTo("Handbooks"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static string AbsolutePath(string fileName) => Path.GetFullPath(Path.Combine(Path.GetTempPath(), fileName));
|
||||
|
||||
Reference in new issue
Block a user