Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/OneWare.Chat/Services/AiBuiltInFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public static void Register(
Handler = () => new
{
activeProject = ResolvePath(projectExplorerService, null)
}
},
DetailExtractor = _ => "active project"
});

functionProvider.RegisterFunction(new OneWareAiFunction
Expand All @@ -99,7 +100,8 @@ Do not assume or invent open files.
.Select(x => ResolvePath(projectExplorerService, x.Key))
.Where(x => !string.IsNullOrWhiteSpace(x))
.ToArray()
}
},
DetailExtractor = _ => "open files"
});

functionProvider.RegisterFunction(new OneWareAiFunction
Expand All @@ -114,7 +116,9 @@ This is the ONLY way to know which file is active.
Handler = () => new
{
currentFile = ResolvePath(projectExplorerService, dockService.CurrentDocument?.FullPath)
}
},
DetailExtractor = _ => GetRelativePath(projectExplorerService, dockService.CurrentDocument?.FullPath)
?? "focused file"
});

functionProvider.RegisterFunction(new OneWareAiFunction
Expand All @@ -124,7 +128,8 @@ This is the ONLY way to know which file is active.
RunOnUiThread = true,
Description = "Returns the LSP Errors for the specified path (if any)",
Handler = ([Description("absolute path of the file to get errors")] string path) =>
GetErrorsForFile(projectExplorerService, errorService, path)
GetErrorsForFile(projectExplorerService, errorService, path),
DetailExtractor = args => GetRelativePath(projectExplorerService, TryGetStringArgument(args, "path"))
});

functionProvider.RegisterFunction(new OneWareAiFunction
Expand All @@ -136,7 +141,8 @@ This is the ONLY way to know which file is active.
Handler = () => new
{
errors = errorService.GetErrors().Select(x => x.ToString()).ToArray()
}
},
DetailExtractor = _ => "all errors"
});

functionProvider.RegisterFunction(new OneWareAiFunction
Expand All @@ -155,6 +161,7 @@ Output is automatically truncated to avoid oversized responses.
CancellationToken cancellationToken = default) =>
RunTerminalCommandAsync(projectExplorerService, terminalManagerService, command, workDir,
cancellationToken),
DetailExtractor = args => TryGetStringArgument(args, "command"),
ConfirmationCheck = args =>
{
var cmd = TryGetStringArgument(args, "command") ?? "?";
Expand All @@ -175,7 +182,8 @@ Output is automatically truncated to avoid oversized responses.
DataContext = ContainerLocator.Container.Resolve<ApplicationSettingsViewModel>()
});
return true;
}
},
DetailExtractor = _ => "IDE settings"
});
}

Expand Down
Loading