Scan with your iPhone to install
Preview
Easily view or continue conversations logged with the “Gemini via API” shortcut.
Optionally uses free actions provided by the Toolbox Pro app to provide the pretty menus. Can be disabled during install if you don't want them
What's New
Version 1.0
First release
What it does
216 actions-
CommentGemini conversation viewer Tim Wilson, December 2023 Easily view or continue conversations logged with the “Gemini via API” shortcut. https://routinehub.co/shortcut/17624/
-
CommentPrepare dictionary of logged conversations
-
CommentSet whether large preview of image for image-based conversations should be shown. 0 for no, 1 for yes to show large preview
-
Number
-
Set VariableShowLargeImagePreview
-
CommentSet whether the free Toolbox Pro app should be used (and must therefore be installed) to show image thumbnails for image conversations in conversation list. 1 to use Toolbox Pro, 0 to not use it. If not used, large image preview will be shown regard…
-
Number
-
Set VariableUseTBP
-
CommentCheck for shortcut updates
-
Nothing
-
Comment【Auto-Update Routine】 Checks For Latest Shortcut Version ↳ https://routinehub.co/shortcut/16590/
-
Dictionary
-
Get Dictionary Value
-
If
-
Get IP Address
-
If
-
Get Contents of URLhttps://routinehub.co/api/v1/shortcuts/…/versions/latest
-
If
-
Split Text
-
Repeat with Each
-
Calculate Expression
-
Set VariableLatest Version
-
Split Text
-
Repeat with Each
-
Calculate Expression
-
Set VariableCurrent Version
-
If
-
Choose from MenuNew Version: … Release: … Whats New: "…"
-
Choose from MenuUpdate → Result (Version)
-
Expand URL
-
Replace Text
-
Open URLs
-
Stop This Shortcut
-
Choose from MenuSkip (Info (Version))
-
Comment【Auto-Update Routine Ends Here】 Support → https://www.reddit.com/r/shortcuts/comments/18j4f9p/ 【⚙️】 Convert Semantic Number to Decimals ↳ https://routinehub.co/shortcut/16589/
-
Nothing
-
CommentBegin dependency check (using “Check-install dependencies (v1)” by Tim Wilson: https://routinehub.co/shortcut/17694/) Dictionary of dependencies, where each: * Key is the name fo the shortcut (used to check if install, so much match perfectly), and …
-
Dictionary
-
Get My Shortcuts
-
Repeat with Each
-
Filter Files
-
If
-
Get IP Address
-
If
-
Show Result
-
If
-
Show Result
-
Get Dictionary Value
-
Set VariableURL
-
Match Text
-
If
-
Get Contents of URLhttps://routinehub.co/api/v1/shortcuts/…/versions/latest
-
Expand URL
-
Set VariableURL
-
Replace Text
-
Open URLs
-
Stop This Shortcut
-
Nothing
-
CommentEnd dependency check
-
Number
-
Number
-
Number
-
Nothing
-
Set VariableConvoDict
-
Set VariableImageDict
-
If
-
Get Device Details
-
If
-
Run Shell Script
-
Set VariableUseTBP
-
If
-
Set VariableShowLargeImagePreview
-
Create Folder
-
Get Contents of Folder
-
Filter Files
-
Repeat with Each
-
Replace Text
-
If
-
Get Dictionary from Input
-
Split Text
-
Get Item from List
-
Set Dictionary Value
-
Set Dictionary Value
-
Text
-
Set Dictionary Value
-
Set VariableConvoDict
-
Add to Variable
-
If
-
Base64 Encode
-
Set Dictionary Value
-
Set VariableImageDict
-
CommentExit if there are no conversations
-
Count
-
If
-
Show Result
-
Stop This Shortcut
-
Count
-
If
-
Set VariableUseTBP
-
CommentPrepare menu of conversations to choose from
-
If
-
Get Device Details
-
If
-
Text
-
If
-
Text
-
Create Menucom.alexhay.ToolboxProForShortcuts
-
Add to Variable
-
Repeat with Each
-
Split Text
-
Get Item from List
-
Replace Text
-
Get Dictionary Value
-
If
-
Get Dictionary Value
-
Base64 Encode
-
Resize Image
-
Create Menucom.alexhay.ToolboxProForShortcuts
-
If
-
Create Menucom.alexhay.ToolboxProForShortcuts
-
Add to Variable
-
Add to Variable
-
If
-
Text
-
Add to Variable
-
Add to Variable
-
Set VariableDeleteList
-
Repeat
-
Choose from List
-
If
-
Get Menu Itemcom.alexhay.ToolboxProForShortcuts
-
Text
-
If
-
Text
-
If
-
Choose from List
-
Get Contents of Folder
-
Repeat with Each
-
If
-
Get Menu Itemcom.alexhay.ToolboxProForShortcuts
-
Text
-
If
-
Text
-
Get Dictionary Value
-
Get Dictionary Value
-
Repeat with Each
-
If
-
Add to Variable
-
Delete Files
-
Run ShortcutView or continue Gemini conversation
-
Stop This Shortcut
-
Get Dictionary Value
-
Set VariableChosenConvo
-
Get Dictionary Value
-
If
-
Text
-
If
-
Replace Text
-
Text
-
Set VariableConvoStr
-
Repeat with Each
-
Text
-
Set VariableConvoStr
-
Get Dictionary Value
-
Repeat with Each
-
Text
-
Set VariableConvoStr
-
Text
-
Set VariableConvoStr
-
Show Result
-
If
-
Get Dictionary Value
-
If
-
Set VariableImage
-
If
-
Base64 Encode
-
Show Result
-
If
-
Text
-
Quick Menu2com.alexhay.ToolboxProForShortcuts
-
Choose from List
-
Set VariableUserChoice
-
If
-
List
-
Choose from List
-
Set VariableUserChoice
-
If
-
Dictionary
-
If
-
Set Dictionary Value
-
Run ShortcutGemini via API
-
If
-
Set Dictionary Value
-
Run ShortcutGemini via API
-
Stop This Shortcut
-
If
-
Get Dictionary Value
-
Get Contents of Folder
-
Set VariableDeleteList
-
Repeat with Each
View as code
Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.
#define mac true
#include 'actions/web'
#include 'actions/network'
#define color lightblue
#define glyph noteText
/*
Gemini conversation viewer
Tim Wilson, December 2023
Easily view
or continue conversations logged with the “Gemini via API” shortcut. https://routinehub.co/shortcut/17624/
*/
// Prepare dictionary of logged conversations
// Set whether large preview of image for image-based conversations should be shown. 0 for no, 1 for yes to show large preview
@ShowLargeImagePreview = 1
// Set whether the free Toolbox Pro app should be used (and must therefore be installed) to show image thumbnails for image conversations in conversation list. 1 to use Toolbox Pro, 0 to not use it. If not used, large image preview will be shown regardless.
@UseTBP = 1
// Check for shortcut updates
nothing()
/*
【Auto-Update Routine】
Checks For Latest Shortcut Version
↳ https://routinehub.co/shortcut/16590/
*/
const Info = {
"Author": "twilsonco",
"RoutineHub ID": 17671,
"Version": "1.4.0",
"Version Check": true
}
const True = getValue(Info, "Version Check")
if True == "Yes" {
const CurrentIPAddress = getExternalIP("IPv4")
if CurrentIPAddress {
const Result = downloadURL("https://routinehub.co/api/v1/shortcuts/{Info['RoutineHub ID']}/versions/latest")
if Result contains "success" {
const SplitText = splitText(Result['Version'], ".")
for _ in SplitText {
@LatestVersion = ((1/1000)^@RepeatIndex)*@RepeatItem+@LatestVersion
}
const SplitText1 = splitText(Info['Version'], ".")
for _ in SplitText1 {
@CurrentVersion = ((1/1000)^@RepeatIndex)*@RepeatItem+@CurrentVersion
}
if @LatestVersion > @CurrentVersion {
menu "New Version: {Result['Version']}\nRelease: {Result['Release']}\nWhats New: \"{Result['Notes']}\"" {
item "Update → {Result['Version']}":
expandURL(Result['URL'])
const UpdatedText = replaceText("https://www.icloud.com/", "shortcuts://", false)
openURL(UpdatedText)
stop()
item "Skip ({Info['Version']})":
}
}
}
}
}
/*
【Auto-Update Routine Ends Here】
Support → https://www.reddit.com/r/shortcuts/comments/18j4f9p/
【⚙️】
Convert Semantic Number to Decimals
↳ https://routinehub.co/shortcut/16589/
*/
nothing()
/*
Begin dependency check
(using “Check-install dependencies (v1)” by Tim Wilson: https://routinehub.co/shortcut/17694/)
Dictionary of dependencies, where each:
* Key is the name fo the shortcut (used to check if install, so much match perfectly), and each value is either:
* The RoutineHub ID (number), or
* The URL (text type; iCloud link to shortcut or some other URL)
*/
const DependencyDict = {
"Gemini via API": 17624
}
const FullShortcutList = getShortcuts()
for _ in DependencyDict['Keys'] {
const Files = filterFiles(FullShortcutList, 1, "Last Modified Date", "Latest First")
if !Files {
const CurrentIPAddress1 = getExternalIP()
if !CurrentIPAddress1 {
show("This shortcut depends on the \"{@RepeatItem}\" shortcut, which was not found (by name) in your installed Shortcuts. You need to be connected to the internet in order to install it. Please connect and try again.")
} else {
show("This shortcut depends on the \"{@RepeatItem}\" shortcut, which was not found (by name) in your installed Shortcuts. Contiunue to install it now, then try this Shortcut again.")
@URL = DependencyDict[@RepeatItem]
const Matches = containsText(DependencyValue, "^[0-9]+$")
if Matches {
const Result1 = downloadURL("https://routinehub.co/api/v1/shortcuts/{DependencyValue}/versions/latest")
expandURL(Result1['URL'])
@URL
}
const UpdatedText1 = replaceText("https://www.icloud.com/", "shortcuts://", @URL, false)
openURL(UpdatedText1)
}
stop()
}
}
nothing()
// End dependency check
const Number = 1000
nothing()
@ConvoDict
@ImageDict
if @UseTBP == {
const DeviceModel = getDeviceDetail("Device Model")
if DeviceModel == "Mac" {
runShellScript("if [[ $(uname -m) == 'arm64' ]]; then\n echo 1\nelse\n echo 0\nfi", DeviceModel)
@UseTBP
}
}
if @UseTBP == 0 {
@ShowLargeImagePreview = True1
}
createFolder("GeminiAPI")
const ContentsOfFolder = getFolderContents()
const Files1 = filterFiles(ContentsOfFolder, "Last Modified Date", "Latest First")
for _ in Files1 {
const UpdatedText2 = replaceText(".{@RepeatItem['File Extension']}", "", @RepeatItem['File Path'])
if @RepeatItem == "txt" {
const Dictionary = getDictionary(@RepeatItem)
const SplitText2 = splitText(UpdatedText2, "/")
getListItems(SplitText2, 0, 0)
const Dictionary1 = setValue(Dictionary, "datetime")
setValue(Dictionary1, "filename", UpdatedText2)
setValue(@ConvoDict)
@ConvoDict
@SortedKeys
} else {
base64Encode(@RepeatItem)
setValue(@ImageDict, UpdatedText2)
@ImageDict
}
}
// Exit if there are no conversations
const Count = count(@ConvoDict)
if Count == 0 {
show("There are no saved Gemini Pro conversations")
stop()
}
const Count1 = count(@ImageDict)
if Count1 == 0 {
@UseTBP = False
}
// Prepare menu of conversations to choose from
if @UseTBP == {
const CurrentAppearance = getDeviceDetail("Current Appearance")
if CurrentAppearance['Dark Mode Is On'] == {
} else {
}
rawAction("com.alexhay.ToolboxProForShortcuts.CreateMenuIntent", {
"bgTransparencyEmoji": 0.32798823714256287,
"customIconType": "emoji",
"defaultBGColour": "Pink",
"defaultIcons": "delete",
"defaultScale": "0.7",
"emojiBG": "{BackgroundColor}",
"emojiName": "❌",
"field1": "Delete conversations",
"title": "Delete conversation(s)"
})
@ChooseList
for _ in @SortedKeys {
const SplitText3 = splitText(@RepeatItem, " - ")
getRandomItem(SplitText3)
replaceText("{} - ", "", @RepeatItem)
if @ImageDict contains ['filename'] {
const DictionaryValue = getValue(@ImageDict, ['filename'])
const Base64Encoded = base64Encode(DictionaryValue)
const ResizedImage = resizeImageByLongestEdge(Base64Encoded, "123")
rawAction("com.alexhay.ToolboxProForShortcuts.CreateMenuIntent", {
"base64": "{DictionaryValue}",
"customIcon": "ResizedImage",
"customIconType": "customImage",
"defaultScale": "0.7",
"field1": "{@RepeatItem}",
"field2": "{@RepeatIndex}",
"subtitle": "{}",
"title": "{}"
})
} else {
rawAction("com.alexhay.ToolboxProForShortcuts.CreateMenuIntent", {
"base64": "{DictionaryValue}",
"bgTransparencyEmoji": 0.2794468091881793,
"customIconType": "emoji",
"defaultScale": "0.7",
"emojiBG": "{BackgroundColor}",
"emojiName": "💬",
"field1": "{@RepeatItem}",
"field2": "{@RepeatIndex}",
"subtitle": "{}",
"title": "{}"
})
}
@ChooseList
@DeleteList
}
} else {
@ChooseList += "❌ Delete conversation(s)"
@ChooseList = @SortedKeys
@DeleteList = @SortedKeys
}
repeat _ for Number {
const ChosenItem = chooseFromList(@ChooseList, "Please select")
if @UseTBP == {
rawAction("com.alexhay.ToolboxProForShortcuts.GetMenuItemIntent", {
"menuItem": "ChosenItem"
})
} else {
}
if ChosenItem1 contains "Delete conversation" {
const ChosenItem2 = chooseFromList(@DeleteList, "Select conversations to delete", true)
const ContentsOfFolder1 = getFolderContents()
for _ in ChosenItem2 {
if @UseTBP == {
rawAction("com.alexhay.ToolboxProForShortcuts.GetMenuItemIntent", {
"menuItem": "@RepeatItem2"
})
} else {
}
const DictionaryValue1 = getValue(@ConvoDict, DeleteItem)
const DeleteFileName = DictionaryValue1['filename']
for _ in ContentsOfFolder1 {
if @RepeatItem3 contains DeleteFileName {
@DeleteList = @RepeatItem3
}
}
}
deleteFiles(@DeleteList, true)
runSelf()
stop()
}
@ChosenConvo = @ConvoDict[ChosenItem1]
const Messages = getValue(@ChosenConvo, "messages")
if @UseTBP == {
} else {
replaceText(" ", " ", ChosenItem)
}
@ConvoStr = "{}"
for _ in Messages {
@ConvoStr = "{@ConvoStr}\n\n==========\n\n{@RepeatItem2['role']}:"
const DictionaryValue2 = getValue(@RepeatItem2, "parts")
for _ in DictionaryValue2 {
@ConvoStr = "{@ConvoStr}\n{@RepeatItem3['text']}"
}
@ConvoStr = "{@ConvoStr}"
}
show(@ConvoStr)
if @ImageDict contains @ChosenConvo['filename'] {
const DictionaryValue3 = getValue(@ImageDict, @ChosenConvo['filename'])
if DictionaryValue3 {
@Image = DictionaryValue3
if @ShowLargeImagePreview == {
base64Encode(DictionaryValue3)
show()
}
}
}
if @UseTBP == {
rawAction("com.alexhay.ToolboxProForShortcuts.QuickMenu2Intent", {
"text": "{}"
})
chooseFromList(MenuItems, "Select action")
@UserChoice = ['title']
} else {
const List = list("Continue conversation", "Delete conversation", "Go back to conversation list")
chooseFromList(List, "Select action")
@UserChoice
}
if @UserChoice contains "Continue" {
const Dictionary2 = {
"datetime": "{['datetime']}",
"repeat": "1"
}
if @Image {
const Dictionary3 = setValue(Dictionary2, "image", @Image)
run("Gemini via API", Dictionary3)
} else {
const Dictionary4 = setValue(Dictionary2, "messages", Messages)
run("Gemini via API", Dictionary4)
}
stop()
}
if @UserChoice contains "Delete" {
const CheckFilePath = @ChosenConvo['filename']
const ContentsOfFolder2 = getFolderContents()
@DeleteList
for _ in ContentsOfFolder2 {
if @RepeatItem2 contains CheckFilePath {
@DeleteList = @RepeatItem2
}
}
deleteFiles(@DeleteList, true)
@NewChooseList
for _ in @ChooseList {
if @UseTBP == {
rawAction("com.alexhay.ToolboxProForShortcuts.GetMenuItemIntent", {
"menuItem": "@RepeatItem2"
})
if MenuItemDetail['field2'] != ['field2'] {
@NewChooseList = @RepeatItem2
}
} else {
if @RepeatItem2 != ChosenItem {
@NewChooseList = @RepeatItem2
}
}
}
if @NewChooseList {
@ChooseList = @NewChooseList
} else {
stop()
}
}
}
Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.
Ratings & Reviews
Write a Review–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings
No reviews yet. Be the first to share what you think!
Advertisement
More by twilsonco
You Might Also Like
Advertisement