ShareShortcuts
Fazer fork de “I Have a Question”

Criou algo novo a partir deste atalho? Compartilhe como uma derivação: ela se torna um atalho seu, que você gerencia, e as duas páginas têm links entre si para que twilsonco receba o crédito.

  1. 1Obtenha o atalho e altere-o no app Atalhos. Dê a ele um nome próprio.
  2. 2Compartilhe pelo app Atalhos e copie o link do iCloud.
  3. 3Volte aqui, cole o link e descreva o que mudou, por exemplo: “Adicionei uma etapa que usa a Apple Intelligence para personalizar o texto.”
Downloads
26K
Salvo
0
Ações
97
Categoria
Productivity
Versão
1.0
Idioma
EN

Voice-only, back-and-forth conversation with "Gemini via API"

This shortcut allows you to have a voice-only, back-and-forth conversation with Google Gemini Pro, using the "Gemini via API" shortcut.

You can also pass this shortcut an image/photo via the share sheet and the image will be included with every request so you can query the same image repeatedly. (No previous messages are retained when an image is used, due to Google API constraints)

Novidades

Versão 1.0

First release

Histórico de versões
1.0 9 de fev de 2024

First release

O que ele faz

97 ações
  1. Comment
    I have a question, Gemini By Tim Wilson, December 2023 This shortcut allows you to have a voice-only, back-and-forth conversation with Google Gemini Pro, using the “Gemini via API” shortcut. https://routinehub.co/shortcut/17624/ You can also pass th…
  2. Text
  3. Text
  4. Comment
    Should conversation logging be disabled? Set to 0 to log, or 1 to disable logging. (Logging conversations slightly slows down the process, potentially causing issues when running with Siri)
  5. Number
  6. Comment
    Check for shortcut updates
  7. Nothing
  8. Comment
    【Auto-Update Routine】 Checks For Latest Shortcut Version ↳ https://routinehub.co/shortcut/16590/
  9. Dictionary
  10. Get Dictionary Value
  11. If
  12. Get IP Address
  13. If
  14. Get Contents of URL
    https://routinehub.co/api/v1/shortcuts/…/versions/latest
  15. If
  16. Split Text
  17. Repeat with Each
  18. Calculate Expression
  19. Set Variable
    Latest Version
  20. Split Text
  21. Repeat with Each
  22. Calculate Expression
  23. Set Variable
    Current Version
  24. If
  25. Choose from Menu
    New Version: … Release: … Whats New: "…"
  26. Choose from Menu
    Update → Result (Version)
  27. Expand URL
  28. Replace Text
  29. Open URLs
  30. Stop This Shortcut
  31. Choose from Menu
    Skip (Info (Version))
  32. 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/
  33. Nothing
  34. 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 …
  35. Dictionary
  36. Get My Shortcuts
  37. Repeat with Each
  38. Filter Files
  39. If
  40. Get IP Address
  41. If
  42. Show Result
  43. If
  44. Show Result
  45. Get Dictionary Value
  46. Set Variable
    URL
  47. Match Text
  48. If
  49. Get Contents of URL
    https://routinehub.co/api/v1/shortcuts/…/versions/latest
  50. Expand URL
  51. Set Variable
    URL
  52. Replace Text
  53. Open URLs
  54. Stop This Shortcut
  55. Nothing
  56. Comment
    End dependency check
  57. Text
  58. Split Text
  59. Combine Text
  60. Text
  61. Dictate Text
  62. Match Text
  63. If
  64. Stop This Shortcut
  65. If
  66. If
  67. Stop This Shortcut
  68. If
  69. Resize Image
  70. Convert Image
  71. Base64 Encode
  72. Set Variable
    Image
  73. Dictionary
  74. If
  75. Dictionary
  76. Run Shortcut
    Gemini via API
  77. Set Variable
    Response
  78. Set Variable
    Messages
  79. Set Variable
    DateTime
  80. Repeat
  81. Speak Text
  82. Wait
  83. Dictate Text
  84. Match Text
  85. If
  86. Stop This Shortcut
  87. If
  88. If
  89. Stop This Shortcut
  90. If
  91. Dictionary
  92. If
  93. Dictionary
  94. Set Dictionary Value
  95. Run Shortcut
    Gemini via API
  96. Set Variable
    Response
  97. Set Variable
    Messages

Ver como código
Beta

Todas as ações deste atalho escritas em Cherri, uma linguagem de programação para o app Atalhos. Ótimo para aprender como ele funciona.

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

/*
I have a question, Gemini
By Tim Wilson, December 2023

This shortcut allows you to have a voice-only, back-and-forth conversation with Google Gemini Pro, using the “Gemini via API” shortcut. https://routinehub.co/shortcut/17624/

You can also pass this shortcut an image/photo via the share sheet and the image will be included with every request so you can query the same image repeatedly. (No previous messages are retained when an image is used, due to Google API constraints)
*/
const InitialSystemPrompt = "Please respond to the following concisely, in paragraph form. No bullet points or lists, because this is a voice conversation. Here is my question/statement:\n\n"
const FollowUpSystemPrompt = ""
// Should conversation logging be disabled? Set to 0 to log, or 1 to disable logging. (Logging conversations slightly slows down the process, potentially causing issues when running with Siri)

const DisableLogging = 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": 17672,
	"Version": "1.2.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 Text = "Stop\nCancel\nNever mind\nDismiss\nExit\nAbort\nQuit\nEnd\nHalt\nKill\nTerminate\nDone\nAll done\nThat's all\nI'm finished\nThat's it \nNo more\nOk\nThank you\nThanks\nBye\nGoodbye\n"
const SplitText2 = splitText(Text)
joinText(SplitText2, ")|(")
const QuitRegex = "^({})$"
const DictatedText = listen("After Pause")
const Matches1 = containsText(DictatedText, QuitRegex)

if Matches1 {
	stop()
} else {
	if !DictatedText {
		stop()
	}
}

if ShortcutInput {
	const ResizedImage = resizeImageByLongestEdge(ShortcutInput, "500")
	const ConvertedImage = convertImage(ResizedImage, "", 1)
	base64Encode(ConvertedImage)
	@Image
} else {
}
@Response = run("Gemini via API", IfResult)
@Messages = GeminiResponse['messages']
@DateTime = GeminiResponse['datetime']

repeat _ for 25 {
	speak(@Response, true)
	wait(3)
	const DictatedText1 = listen("After Pause")
	const Matches2 = containsText(DictatedText1, QuitRegex)
	if Matches2 {
		stop()
	} else {
		if !DictatedText1 {
			stop()
		}
	}
	if @Image {
	} else {
		const Dictionary = {
			"datetime": "{@DateTime}",
			"disablelogging": "{DisableLogging}",
			"prompt": "{DictatedText1}"
		}
		setValue(Dictionary, "messages", @Messages)
	}
	@Response = run("Gemini via API", IfResult1)
	@Messages = FollowupOutput['messages']
}
Abrir no Cherri Playground Descompilado com cherri 2.3.0 (GPL-2.0). Pode precisar de pequenos ajustes antes de compilar.

Avaliações e comentários

Escrever uma avaliação
–
de 5
★★★★★
★★★★
★★★
★★
★
0 ratings

Ainda não há avaliações. Seja o primeiro a compartilhar o que você pensa!

Publicidade

Mais de twilsonco

Ver tudo

Você também pode gostar

Ver tudo
Publicidade