Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds fix for args parsing #260

Closed
wants to merge 1 commit into from
Closed

Conversation

krisbitney
Copy link
Contributor

@krisbitney krisbitney commented Oct 2, 2023

With the prompt web scrape all the links from https://polywrap.io, the string Evo tries to pass to agent.speak is invalid JSON:

{
  "namespace": "agent.speak",
  "arguments": "{\"message\":\"Here are the links I found on https://polywrap.io: \n1. https://docs.polywrap.io/ \n2. https://ens.domains/ \n3. https://ethereum.org \n4. https://gelato.network/ \n5. https://ipfs.tech/ \n6. https://near.org \n7. https://pokt.network \n8. https://polkadot.network \n9. https://gnosis-safe.io/ \n10. https://tezos.com \n11. https://uniswap.org \n12. https://coinfund.io/ \n13. https://placeholder.vc/ \n14. https://trueventures.com/ \n15. https://portal.vc/ \n16. https://zeeprime.capital/ \n17. https://atka.io/ \n18. https://trgc.io/ \n19. https://ascensiveassets.com/ \n20. https://rarestone.capital/ \n21. https://gnosis.com \n22. https://iosg.vc/ \n23. https://blockwatch.cc/ \n24. https://chainsafe.io/ \n25. https://consideritdone.tech/ \n26. https://dorg.tech \n27. https://discord.com/invite/Z5m88a5qWu \n28. https://wrapscan.io/ \n29. https://github.com/polywrap \n30. https://twitter.com/polywrap_io \n31. https://blog.polywrap.io/ \n32. https://handbook.polywrap.io/ \n33. https://forum.polywrap.io/ \n34. https://snapshot.org/#/polywrap.eth\"}",
  "result": "_"
}

This can be fixed to with a simple String.replace:

{
  "namespace": "agent.speak",
  "arguments": "{\"message\":\"Here are the links I found on https://polywrap.io: \n1. https://docs.polywrap.io/ \n2. https://ens.domains/ \n3. https://ethereum.org \n4. https://gelato.network/ \n5. https://ipfs.tech/ \n6. https://near.org \n7. https://pokt.network \n8. https://polkadot.network \n9. https://gnosis-safe.io/ \n10. https://tezos.com \n11. https://uniswap.org \n12. https://coinfund.io/ \n13. https://placeholder.vc/ \n14. https://trueventures.com/ \n15. https://portal.vc/ \n16. https://zeeprime.capital/ \n17. https://atka.io/ \n18. https://trgc.io/ \n19. https://ascensiveassets.com/ \n20. https://rarestone.capital/ \n21. https://gnosis.com \n22. https://iosg.vc/ \n23. https://blockwatch.cc/ \n24. https://chainsafe.io/ \n25. https://consideritdone.tech/ \n26. https://dorg.tech \n27. https://discord.com/invite/Z5m88a5qWu \n28. https://wrapscan.io/ \n29. https://github.com/polywrap \n30. https://twitter.com/polywrap_io \n31. https://blog.polywrap.io/ \n32. https://handbook.polywrap.io/ \n33. https://forum.polywrap.io/ \n34. https://snapshot.org/#/polywrap.eth\"}",
  "result": "speakResult"
}

? params.arguments
.replace(/\{\{/g, "\\{\\{")
.replace(/\}\}/g, "\\}\\}")
.replace(/\\\"/g, '"')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels oddly specific, and like it might break things in different situations

@krisbitney krisbitney closed this Oct 2, 2023
@cbrzn cbrzn deleted the fix-args-when-string-list branch December 6, 2023 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants