|
|
|
@@ -417,6 +417,46 @@ Function AiImageUrl(ByVal prompt) |
|
|
|
AiImageUrl = "/ai-image?prompt=" & Server.URLEncode(Trim(CStr(prompt))) |
|
|
|
End Function |
|
|
|
|
|
|
|
Function GetAiImageProvider() |
|
|
|
Dim provider |
|
|
|
provider = LCase(Trim(CStr(GetAppSetting("AiImageProvider")))) |
|
|
|
If Len(provider) = 0 Or provider = "nothing" Then |
|
|
|
provider = "pollinations" |
|
|
|
End If |
|
|
|
GetAiImageProvider = provider |
|
|
|
End Function |
|
|
|
|
|
|
|
Function GetAiImageRemoteBaseUrl() |
|
|
|
Dim provider, baseUrl |
|
|
|
provider = GetAiImageProvider() |
|
|
|
|
|
|
|
If provider = "abacus" Then |
|
|
|
baseUrl = Trim(CStr(GetAppSetting("AbacusImageBaseUrl"))) |
|
|
|
If Len(baseUrl) = 0 Or LCase(baseUrl) = "nothing" Then |
|
|
|
baseUrl = Trim(CStr(GetAppSetting("AiImageBaseUrl"))) |
|
|
|
End If |
|
|
|
Else |
|
|
|
baseUrl = Trim(CStr(GetAppSetting("AiImageBaseUrl"))) |
|
|
|
End If |
|
|
|
|
|
|
|
If Len(baseUrl) = 0 Or LCase(baseUrl) = "nothing" Then |
|
|
|
baseUrl = "https://image.pollinations.ai/prompt/" |
|
|
|
End If |
|
|
|
|
|
|
|
If Right(baseUrl, 1) <> "/" Then baseUrl = baseUrl & "/" |
|
|
|
GetAiImageRemoteBaseUrl = baseUrl |
|
|
|
End Function |
|
|
|
|
|
|
|
Function GetAiImageRemoteUrl(ByVal prompt) |
|
|
|
Dim cleanPrompt |
|
|
|
cleanPrompt = Trim(CStr(prompt)) |
|
|
|
If Len(cleanPrompt) = 0 Then |
|
|
|
GetAiImageRemoteUrl = "" |
|
|
|
Else |
|
|
|
GetAiImageRemoteUrl = GetAiImageRemoteBaseUrl() & Server.URLEncode(cleanPrompt) |
|
|
|
End If |
|
|
|
End Function |
|
|
|
|
|
|
|
'------------------------------------------------------------------------------ |
|
|
|
' Canonical application URL helpers |
|
|
|
' - Categories use numeric IDs |
|
|
|
@@ -950,7 +990,11 @@ Function GetOrCreateAiImageUrl(ByVal prompt) |
|
|
|
Exit Function |
|
|
|
End If |
|
|
|
|
|
|
|
remoteUrl = "https://image.pollinations.ai/prompt/" & Server.URLEncode(cleanPrompt) |
|
|
|
remoteUrl = GetAiImageRemoteUrl(cleanPrompt) |
|
|
|
If Len(remoteUrl) = 0 Then |
|
|
|
GetOrCreateAiImageUrl = "" |
|
|
|
Exit Function |
|
|
|
End If |
|
|
|
|
|
|
|
On Error Resume Next |
|
|
|
Set shell = Server.CreateObject("WScript.Shell") |
|
|
|
|