-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaitoolkit.psm1
35 lines (30 loc) · 1.17 KB
/
aitoolkit.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$script:PSModuleRoot = $script:ModuleRoot = $PSScriptRoot
$script:aitoolkitBaseUrl = "http://localhost:5272"
function Import-ModuleFile {
[CmdletBinding()]
Param (
[string]$Path
)
if ($doDotSource) { . $Path }
else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($Path))), $null, $null) }
}
# Import all internal functions
foreach ($function in (Get-ChildItem "$ModuleRoot\private\" -Filter "*.ps1" -Recurse -ErrorAction Ignore)) {
. Import-ModuleFile -Path $function.FullName
}
# Import all public functions
foreach ($function in (Get-ChildItem "$ModuleRoot\public" -Filter "*.ps1" -Recurse -ErrorAction Ignore)) {
. Import-ModuleFile -Path $function.FullName
}
try {
if (-not $PSDefaultParameterValues['Invoke-RestMethod:TimeoutSec']) {
$removetimeout = $true
$PSDefaultParameterValues['Invoke-RestMethod:TimeoutSec'] = 1
}
$script:mountedmodel = Get-AITMountedModel -ErrorAction Stop | Select-Object -Last 1 -ExpandProperty Model
if ($removetimeout) {
$null = $PSDefaultParameterValues.Remove('Invoke-RestMethod:TimeoutSec')
}
} catch {
# don't care
}