ShareShortcuts
Создать форк «What is this?»

Создали что-то новое на основе этой команды? Поделитесь ей как форком: она станет вашей собственной командой, которой вы управляете, а обе страницы будут ссылаться друг на друга, чтобы twilsonco получил(а) признание.

  1. 1Получите команду и измените её в приложении «Быстрые команды». Дайте ей собственное название.
  2. 2Поделись ею из приложения «Быстрые команды» и скопируй ссылку iCloud.
  3. 3Вернись сюда, вставь ссылку и опиши, что изменилось, например: «Добавлен шаг, который использует Apple Intelligence для персонализации текста».
Загрузки
26K
Сохранено
0
Действия
59
Категория
Photos and videos
Версия
1.0
Язык
EN

Image recognition using "Gemini via API"

A simple example of a shortcut utilizing the “Gemini via API” shortcut.

This takes a picture and has gemini describe it. This is intended to be used via Siri or through a widget.

Что нового

Версия 1.0

First release

История версий
1.0 9 фев 2024 г.

First release

Что делает

Действий: 59
  1. Comment
    What is this? Tim Wilson, December 2023 A simple example of a shortcut utilizing the “Gemini via API” shortcut. https://routinehub.co/shortcut/17624/ This takes a picture and has gemini describe it. This is intended to be used via Siri or through a …
  2. Comment
    Check for shortcut updates
  3. Nothing
  4. Comment
    【Auto-Update Routine】 Checks For Latest Shortcut Version ↳ https://routinehub.co/shortcut/16590/
  5. Dictionary
  6. Get Dictionary Value
  7. If
  8. Get IP Address
  9. If
  10. Get Contents of URL
    https://routinehub.co/api/v1/shortcuts/…/versions/latest
  11. If
  12. Split Text
  13. Repeat with Each
  14. Calculate Expression
  15. Set Variable
    Latest Version
  16. Split Text
  17. Repeat with Each
  18. Calculate Expression
  19. Set Variable
    Current Version
  20. If
  21. Choose from Menu
    New Version: … Release: … Whats New: "…"
  22. Choose from Menu
    Update → Result (Version)
  23. Expand URL
  24. Replace Text
  25. Open URLs
  26. Stop This Shortcut
  27. Choose from Menu
    Skip (Info (Version))
  28. 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/
  29. Nothing
  30. Comment
    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 …
  31. Dictionary
  32. Get My Shortcuts
  33. Repeat with Each
  34. Filter Files
  35. If
  36. Get IP Address
  37. If
  38. Show Result
  39. If
  40. Show Result
  41. Get Dictionary Value
  42. Set Variable
    URL
  43. Match Text
  44. If
  45. Get Contents of URL
    https://routinehub.co/api/v1/shortcuts/…/versions/latest
  46. Expand URL
  47. Set Variable
    URL
  48. Replace Text
  49. Open URLs
  50. Stop This Shortcut
  51. Nothing
  52. Comment
    End dependency check
  53. Take Photo
  54. Save to Photo Album
  55. Base64 Encode
  56. Dictionary
  57. Run Shortcut
    Gemini via API
  58. Get Dictionary Value
  59. Speak Text

Посмотреть как код
Бета

Все действия этой команды, записанные на Cherri — языке программирования для приложения «Быстрые команды». Отлично подходит, чтобы разобраться, как она работает.

#include 'actions/web'
#include 'actions/network'
#define color darkblue
#define glyph cameraViewFinder

/*
What is this?
Tim Wilson, December 2023

A simple example of a shortcut utilizing the “Gemini via API” shortcut. https://routinehub.co/shortcut/17624/

This takes a picture and has gemini describe it. This is intended to be used via Siri or through a widget.
*/
// Check for shortcut updates

nothing()
/*
【Auto-Update Routine】
Checks For Latest Shortcut Version
↳ https://routinehub.co/shortcut/16590/
*/
const Info = {
	"Author": "twilsonco",
	"RoutineHub ID": 17670,
	"Version": "1.1.1",
	"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 Photo = takePhoto(1, true)
savePhoto(Photo)
base64Encode(Photo)
const Dictionary = {
	"image": "{}",
	"prompt": "What is this photo?"
}
const ShortcutResult = run("Gemini via API", Dictionary)
speak()
Открыть в Cherri Playground Декомпилировано с помощью cherri 2.3.0 (GPL-2.0). Перед компиляцией могут понадобиться небольшие исправления.

Оценки и отзывы

Написать отзыв
–
из 5
★★★★★
★★★★
★★★
★★
★
0 ratings

Пока нет отзывов. Поделись мнением первым!

Реклама

Ещё от twilsonco

См. все

Вам также может понравиться

См. все
Реклама