Skip to content

Commit 57a0cf5

Browse files
committed
allow relative StreamingAssets paths for models
1 parent a4165aa commit 57a0cf5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Runtime/LLMManager.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,20 @@ public class ModelEntry
1919
public bool includeInBuild;
2020
public int contextLength;
2121

22+
public static string GetFilenameOrRelativeAssetPath(string path)
23+
{
24+
string assetPath = LLMUnitySetup.GetAssetPath(path); // Note: this will return the full path if a full path is passed
25+
string basePath = LLMUnitySetup.GetAssetPath();
26+
if (File.Exists(assetPath) && LLMUnitySetup.IsSubPath(assetPath, basePath))
27+
{
28+
return LLMUnitySetup.RelativePath(assetPath, basePath);
29+
}
30+
return path;
31+
}
32+
2233
public ModelEntry(string path, bool lora = false, string label = null, string url = null)
2334
{
24-
filename = Path.GetFileName(path);
35+
filename = GetFilenameOrRelativeAssetPath(path);
2536
this.label = label == null ? filename : label;
2637
this.lora = lora;
2738
this.path = LLMUnitySetup.GetFullPath(path);

0 commit comments

Comments
 (0)