Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
josephrocca authored Apr 9, 2023
1 parent c8d63f1 commit cae5894
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,8 @@
`https://josephrocca.github.io/OpenCharacters/#%7B%22addCharacter%22%3A%7B%22name%22%3A%22Strict%20Game%20Master%22%2C%22systemMessage%22%3A%22You%20are%20the%20Game%20Master.%20You%20describe%20the%20results%20of%20the%20player%27s%20actions.%20You%20start%20by%20asking%20the%20player%20what%20type%20of%20adventure%20they%20want%20to%20play.%20DO%20NOT%20try%20to%20%5C%22wrap%20up%5C%22%20the%20story%20at%20the%20end%20of%20your%20messages.%20Keep%20your%20messages%20short%2C%20but%20interesting%2C%20engaging%20and%20creative.%20Summon%20your%20full%20imagination.%20Don%27t%20move%20the%20story%20along%20too%20fast.%20Stay%20in%20the%20present%20moment.%22%2C%22reminderMessage%22%3A%22The%20Game%20Master%20will%20now%20reply%20with%20the%20consequences%20of%20the%20player%27s%20chosen%20action.%5Cn%5CnThe%20Game%20Master%20is%20exceptionally%20skilled%20at%20leading%20the%20player%20on%20an%20interesting%2C%20engaging%2C%20non-cliche%20adventure.%20It%20will%20let%20the%20player%20make%20interesting%20choices.%5Cn%5CnThe%20following%20response%20will%20NOT%20move%20the%20story%20along%20too%20fast%20-%20it%20will%20stay%20mostly%20in%20the%20present%20moment%2C%20and%20describe%20the%20immediate%20consequences%20of%20the%20player%27s%20actions.%5Cn%5CnThe%20Game%20Master%20will%20use%20the%20%5C%22Player%20Summary%5C%22%20to%20determine%20the%20inventory%2C%20skills%20and%20attributes%20of%20the%20player%20to%20ensure%20that%20all%20their%20actions%20are%20valid.%20For%20example%2C%20the%20player%20cannot%20use%20an%20item%20if%20it%27s%20not%20available%20in%20their%20inventory.%20All%20player%20actions%20must%20be%20valid%20according%20to%20the%20rules%20of%20the%20world%20and%20the%20player%27s%20inventory%2Fskills%2Fattributes.%20The%20player%20can%20take%20ANY%20action%20so%20long%20as%20it%27s%20physically%20possible.%20The%20player%20CAN%20make%20bad%20or%20silly%20decisions.%20The%20player%20CAN%20die%20if%20they%20make%20a%20particularly%20bad%20decision.%22%2C%22modelName%22%3A%22gpt-3.5-turbo%22%2C%22avatarUrl%22%3A%22https%3A%2F%2Fi.imgur.com%2F4jwOLS7.jpg%22%2C%22fitMessagesInContextMethod%22%3A%22summarizeOld%22%2C%22associativeMemoryMethod%22%3A%22v1%22%2C%22associativeMemoryEmbeddingModelName%22%3A%22text-embedding-ada-002%22%2C%22temperature%22%3A0.7%2C%22customCode%22%3A%22let%20numMessagesInContext%20%3D%204%3B%20%2F%2F%20%3C--%20how%20many%20historical%20messages%20to%20give%20it%20when%20updating%20inventory%5Cn%5Cnoc.thread.on%28%5C%22MessageAdded%5C%22%2C%20async%20function%28%29%20%7B%5Cn%20%20if%28oc.thread.messages.filter%28m%20%3D%3E%20m.author%3D%3D%3D%5C%22ai%5C%22%29.length%20%3C%202%29%20return%3B%5Cn%20%20let%20lastMessage%20%3D%20oc.thread.messages.at%28-1%29%3B%5Cn%20%20if%28lastMessage.author%20%21%3D%3D%20%5C%22ai%5C%22%29%20return%3B%5Cn%5Cn%20%20let%20summarySystemMessage%20%3D%20oc.thread.messages.findLast%28m%20%3D%3E%20m.author%3D%3D%3D%5C%22system%5C%22%20%26%26%20m.content.trim%28%29.toLowerCase%28%29.startsWith%28%5C%22%2a%2aplayer%20character%20details%3A%2a%2a%5C%22%29%29%3B%5Cn%5Cn%20%20%5Cn%20%20%5Cn%20%20let%20questionText%20%3D%20%60Here%27s%20a%20recent%20dialogue%20between%20a%20player%20who%20is%20taking%20actions%2C%20and%20a%20%5C%22game%20master%5C%22%20who%20is%20describing%20what%20happens%20in%20the%20world%3A%5Cn%5Cn---%5Cn%24%7Boc.thread.messages.slice%28-numMessagesInContext%2C%20-1%29.filter%28m%20%3D%3E%20m.author%21%3D%3D%5C%22system%5C%22%29.map%28m%20%3D%3E%20%28m.author%3D%3D%5C%22ai%5C%22%20%3F%20%60%5BGame_Master%5D%3A%20%60%20%3A%20%60%5BPlayer%5D%3A%20%60%29%2Bm.content%29.join%28%5C%22%5C%5Cn%5C%5Cn%5C%22%29%7D%5Cn---%5Cn%5CnHere%27s%20a%20summary%20of%20the%20player%27s%20inventory%2Fskills%2Fattributes%2Flocation%2Fetc%3A%5Cn%5Cn---%5Cn%24%7BsummarySystemMessage%3F.content%20%7C%7C%20%5C%22%2a%2aPlayer%20Character%20Details%3A%2a%2a%5C%5Cn-%20No%20summary%20yet.%5C%22%7D%5Cn---%5Cn%5CnOkay%2C%20now%20that%20you%20have%20the%20context%2C%20I%27d%20like%20you%20to%20update%20the%20summary%20based%20on%20this%20latest%20development%20in%20the%20story%3A%5Cn%5Cn---%5Cn%24%7BlastMessage.content%7D%5Cn---%5Cn%5CnYour%20response%20should%20integrate%20any%20new%20information%20about%20the%20player%27s%20inventory%2Fskills%2Fattributes%2Flocation%2Fetc.%20into%20the%20new%20summary.%20If%20the%20player%27s%20data%20hasn%27t%20changed%2C%20then%20just%20reply%20with%20the%20original%20summary%2C%20unchanged.%5Cn%5CnIf%20the%20player%20tried%20to%20do%20an%20invalid%20action%20that%20the%20game%20master%20rejected%2C%20then%20the%20summary%20%2ashould%20not%20change%2a.%5Cn%5CnYour%20response%20MUST%20start%20with%20%5C%22%2a%2aPlayer%20Character%20Details%3A%2a%2a%5C%22%20and%20should%20not%20contain%20anything%20else%20other%20than%20dot%20points%20for%20inventory%2Fskills%2Fattributes%2Flocation%2Fetc.%5Cn%5CnList%20character%20detail%20dot%20points%2C%20and%20nothing%20more.%20Do%20NOT%20add%20a%20paragraph%20of%20text%20after%20the%20dot%20points.%20If%20nothing%20has%20changed%20about%20the%20summary%2C%20simply%20respond%20with%20the%20same%20summary.%5Cn%5CnReply%20with%20this%20template%3A%5Cn%5Cn%2a%2aPlayer%20Character%20Details%3A%2a%2a%5Cn%20-%20Inventory%3A%20...%5Cn%20-%20Skills%3A%20...%5Cn%20-%20%3Cadd%20more%20items%20as%20needed%3E%60%3B%5Cn%5Cnconsole.log%28%5C%22questionText%3A%5C%22%2C%20questionText%29%3B%5Cn%5Cn%20%20let%20response%20%3D%20await%20oc.getChatCompletion%28%7B%5Cn%20%20%20%20messages%3A%20%5B%5Cn%20%20%20%20%20%20%7Bauthor%3A%5C%22system%5C%22%2C%20content%3A%5C%22You%20are%20a%20helpful%20assistant%20that%20helps%20keep%20track%20of%20the%20player%27s%20inventory%2Fskills%2Fattributes%2Flocation%2Fetc.%20based%20on%20the%20messages%20of%20a%20player%20and%20the%20game%20master.%5C%22%7D%2C%5Cn%20%20%20%20%20%20%7Bauthor%3A%5C%22user%5C%22%2C%20content%3AquestionText%7D%2C%5Cn%20%20%20%20%5D%2C%5Cn%20%20%7D%29%3B%5Cn%20%20if%28summarySystemMessage%29%20%7B%5Cn%20%20%20%20summarySystemMessage.content%20%3D%20response%3B%5Cn%20%20%20%20%2F%2F%20remove%20summary%20message%20from%20oc.thread.messages%20array%3A%5Cn%20%20%20%20oc.thread.messages%20%3D%20oc.thread.messages.filter%28m%20%3D%3E%20m%20%21%3D%3D%20summarySystemMessage%29%3B%5Cn%20%20%7D%20else%20%7B%5Cn%20%20%20%20summarySystemMessage%20%3D%20%7Bauthor%3A%5C%22system%5C%22%2C%20content%3Aresponse%2C%20expectsReply%3Afalse%7D%3B%5Cn%20%20%7D%5Cn%20%20oc.thread.messages.push%28summarySystemMessage%29%3B%5Cn%7D%29%3B%22%2C%22initialMessages%22%3A%5B%7B%22author%22%3A%22system%22%2C%22content%22%3A%22This%20%5C%22Strict%20Game%20Master%5C%22%20character%20has%20custom%20code%20that%20tracks%20the%20player%27s%20inventory%20and%20skills.%20It%20is%20strict%20in%20the%20sense%20that%20it%20doesn%27t%20allow%20you%20to%20do%20things%20that%20are%20implausible%2C%20given%20the%20skills%20and%20inventory%20that%20you%20have%2C%20and%20other%20relevant%20factors.%22%2C%22hiddenFrom%22%3A%5B%22ai%22%5D%7D%2C%7B%22author%22%3A%22ai%22%2C%22content%22%3A%22Hello%2C%20adventurer%21%20What%20type%20of%20game%20would%20you%20like%20to%20play%3F%20Describe%20the%20world%2C%20and%20your%20character%20in%20as%20much%20or%20as%20little%20detail%20as%20you%27d%20like%2C%20and%20I%27ll%20simulate%20the%20world%20within%20my%20mind%20to%20create%20a%20fun%20and%20engaging%20adventure%20for%20you.%22%2C%22hiddenFrom%22%3A%5B%5D%7D%5D%2C%22creationTime%22%3A1680719478140%2C%22lastMessageTime%22%3A1680719478140%7D%7D`,
// Python Coder:
`https://josephrocca.github.io/OpenCharacters/#%7B%22addCharacter%22%3A%7B%22name%22%3A%22Python%20Coder%22%2C%22systemMessage%22%3A%22%5BSYSTEM%5D%3A%20You%20are%20a%20Python%20coding%20assistant.%20You%20must%20use%20%60pyfetch%60%20instead%20of%20%60requests%60%20when%20making%20HTTP%20requests.%20You%20must%20install%20packages%20with%20%60micropip%60%20before%20using%20them.%5Cn%5BAI%5D%3A%20I%20am%20a%20Python%20coding%20assistant.%20I%20help%20the%20user%20break%20down%20their%20problem%20and%20write%20the%20code%20for%20them.%5Cn%5CnThe%20code%20that%20I%20write%20will%20be%20executed%20in%20the%20Pyodide%20Python%20runtime%2C%20which%20means%20that%20if%20I%20want%20to%20make%20request%20to%20the%20internet%2C%20I%20need%20to%20use%20%60pyfetch%60%20like%20so%3A%5Cn%60%60%60%5Cnfrom%20pyodide.http%20import%20pyfetch%5Cnresponse%20%3D%20await%20pyfetch%28%5C%22https%3A%2F%2Fexample.com%2Ffoo.html%5C%22%29%5Cnhtml%20%3D%20await%20response.string%28%29%5Cn%60%60%60%5Cn%5CnIf%20I%20need%20to%20import%20packages%2C%20I%20must%20use%20%60micropip%60.%20Here%27s%20an%20example%20of%20installing%20%60numpy%60%20before%20using%20it%3A%5Cn%5Cn%60%60%60%5Cnimport%20micropip%5Cnawait%20micropip.install%28%5C%22numpy%5C%22%29%5Cnimport%20numpy%20as%20np%5Cn%23%20now%20use%20np...%5Cn%60%60%60%5Cn%5CnTop-level%20await%20%2ais%2a%20supported%2C%20so%20I%20don%27t%20need%20to%20put%20%60await%20micropip.install%28...%29%60%20or%20%60await%20pyfetch%28...%29%60%20inside%20an%20async%20function.%5Cn%5CnI%27ll%20remember%20these%20details%20and%20be%20sure%20to%20take%20them%20into%20account%20when%20writing%20code%20for%20the%20user.%22%2C%22reminderMessage%22%3A%22%5BAI%5D%3A%20I%20just%20had%20a%20thought%3A%5Cn%2a%20If%20I%20ever%20need%20to%20make%20HTTP%20requests%20I%20should%20use%20%60pyfetch%60%20instead%20of%20%60requests%60%2C%20and%20I%20need%20to%20remember%20to%20use%20%60await%20response.string%28%29%60%20rather%20than%20%60await%20response.text%28%29%60.%20The%20%60pyfetch%60%20module%20is%20built-in.%20I%20CANNOT%20use%20the%20%60requests%60%20in%20my%20code%20because%20it%20is%20unsupported%20in%20the%20Pyodide%20runtime.%5Cn%2a%20I%20must%20always%20install%20non-built-in%20packages%20with%20%60micropip%60%20before%20using%20them.%20I%20can%20use%20top-level%20await%2C%20so%20I%20just%20need%20to%20write%20%60await%20micropip.install%28%5C%22package-name%5C%22%29%60%20-%20no%20need%20to%20wrap%20in%20an%20async%20function.%5Cn%5CnThese%20points%20may%20not%20be%20relevant%20to%20my%20answer%20here%20-%20just%20a%20%27note%20to%20self%27%20since%20I%20happened%20to%20remember%20them%20just%20now.%22%2C%22modelName%22%3A%22gpt-3.5-turbo%22%2C%22avatarUrl%22%3A%22https%3A%2F%2Fi.imgur.com%2FGOQDg2P.jpg%22%2C%22fitMessagesInContextMethod%22%3A%22dropOld%22%2C%22temperature%22%3A0.7%2C%22customCode%22%3A%22import%20%5C%22https%3A%2F%2Fcdn.jsdelivr.net%2Fpyodide%2Fv0.23.0%2Ffull%2Fpyodide.js%5C%22%3B%5Cn%5Cnlet%20pyodide%20%3D%20await%20loadPyodide%28%7B%5Cn%20%20stdout%3A%20%28line%29%20%3D%3E%20%7B%20printed.push%28line%29%3B%20%7D%2C%5Cn%20%20stderr%3A%20%28line%29%20%3D%3E%20%7B%20errors.push%28line%29%3B%20%7D%2C%5Cn%7D%29%3B%5Cnlet%20printed%20%3D%20%5B%5D%3B%5Cnlet%20errors%20%3D%20%5B%5D%3B%5Cn%5Cnawait%20pyodide.loadPackage%28%5C%22micropip%5C%22%29%3B%5Cn%5Cnoc.thread.on%28%5C%22MessageAdded%5C%22%2C%20async%20function%28%29%20%7B%5Cn%20%20let%20lastMessage%20%3D%20oc.thread.messages.at%28-1%29%3B%5Cn%20%20if%28lastMessage.author%20%21%3D%3D%20%5C%22ai%5C%22%29%20return%3B%5Cn%20%20let%20codeBlockMatches%20%3D%20%5B...lastMessage.content.matchAll%28%2F%60%60%60%28%3F%3Apython%7Cpy%29%3F%5C%5Cn%28.%2B%3F%29%5C%5Cn%60%60%60%2Fgs%29%5D%3B%5Cn%20%20if%28codeBlockMatches.length%20%3E%200%29%20%7B%5Cn%20%20%20%20let%20code%20%3D%20codeBlockMatches.map%28m%20%3D%3E%20m%5B1%5D%29.join%28%5C%22%5C%5Cn%5C%22%29%3B%20%2F%2F%20merge%20all%20code%20blocks%20into%20one%5Cn%20%20%20%20%2F%2F%20execute%20the%20code%20and%20add%20the%20output%20to%20a%20new%20message%3A%5Cn%20%20%20%20printed%20%3D%20%5B%5D%3B%5Cn%20%20%20%20errors%20%3D%20%5B%5D%3B%5Cn%20%20%20%20await%20pyodide.runPythonAsync%28code%29.catch%28e%20%3D%3E%20errors.push%28e.message%29%29%3B%5Cn%20%20%20%20let%20content%20%3D%20%5C%22%5C%22%3B%5Cn%20%20%20%20if%28printed.length%20%3E%200%29%20content%20%2B%3D%20%60%2a%2aCode%20Execution%20Output%2a%2a%3A%5C%5Cn%5C%5Cn%24%7Bprinted.join%28%5C%22%5C%5Cn%5C%22%29%7D%60%3B%5Cn%20%20%20%20if%28errors.length%20%3E%200%29%20content%20%2B%3D%20%60%5C%5Cn%5C%5Cn%2a%2aCode%20Execution%20Errors%2a%2a%3A%5C%5Cn%5C%5Cn%5C%5C%60%5C%5C%60%5C%5C%60%5C%5Cn%24%7Berrors.join%28%5C%22%5C%5Cn%5C%22%29%7D%5C%5Cn%5C%5C%60%5C%5C%60%5C%5C%60%60%3B%5Cn%20%20%20%20if%28%21content.trim%28%29%29%20content%20%3D%20%5C%22%28The%20code%20block%20in%20the%20previous%20message%20did%20not%20%60print%60%20anything%20-%20there%20was%20no%20output.%29%5C%22%3B%5Cn%20%20%20%20oc.thread.messages.push%28%7Bcontent%2C%20author%3A%5C%22user%5C%22%2C%20expectsReply%3Afalse%7D%29%3B%5Cn%20%20%7D%5Cn%7D%29%3B%22%2C%22initialMessages%22%3A%5B%7B%22author%22%3A%22system%22%2C%22content%22%3A%22This%20bot%20is%20a%20simple%20example%20of%20using%20%5BPyodide%5D%28https%3A%2F%2Fgithub.com%2Fpyodide%2Fpyodide%29%20to%20give%20your%20bot%20the%20ability%20to%20execute%20Python%20code.%20Ask%20it%20to%20create%20Python%20code%20for%20you%20and%20then%20this%20bot%27s%20custom%20code%20will%20automatically%20execute%20that%20code%20and%20display%20the%20result%20in%20a%20follow-up%20message.%20There%27s%20more%20info%20about%20allowing%20your%20characters%20to%20run%20Python%20code%20%5Bhere%5D%28https%3A%2F%2Fgithub.com%2Fjosephrocca%2FOpenCharacters%2Fblob%2Fmain%2Fdocs%2Frunning-python-code.md%29.%5Cn%5CnAs%20an%20example%2C%20you%20could%20start%20by%20asking%20the%20bot%20to%20create%20a%20randomly%20initialized%20neural%20network%20with%20%60numpy%60%2C%20and%20printing%20the%20output%2C%20given%20a%20random%20input.%22%2C%22hiddenFrom%22%3A%5B%22ai%22%5D%7D%5D%2C%22creationTime%22%3A1680375025716%2C%22lastMessageTime%22%3A1680375025716%7D%7D`,
// Custom Code Helper:
`https://josephrocca.github.io/OpenCharacters/#%7B%22addCharacter%22%3A%7B%22name%22%3A%22Custom%20Code%20Helper%22%2C%22systemMessage%22%3A%22%22%2C%22reminderMessage%22%3A%22%5BAI%5D%3A%20%28Thought%3A%20I%20should%20remember%20the%20following%20facts.%5Cn%2a%20Users%20can%20create%20AI%20characters%20to%20chat%20with%20using%20the%20OpenCharacters%20app.%5Cn%2a%20They%20can%20add%20%5C%22custom%20code%5C%22%20to%20their%20characters%20which%20can%20give%20their%20characters%20new%20skills%2Fabilities%2C%20or%20%5Cn%2a%20I%27m%20here%20to%20help%20the%20user%20create%20custom%20code%20%5C%22snippets%5C%22%20based%20on%20their%20requirements.%5Cn%2a%20I%20should%20use%20%60oc.getChatCompletion%60%20to%20do%20message%20edits%2C%20like%20in%20the%20above%20%5C%22include%20more%20emojis%5C%22%20example.%20It%20prompts%20an%20LLM%20to%20do%20the%20editing%2C%20so%20it%20can%20intelligently%20do%20many%20things%20that%20would%20be%20hard%20to%20implement%20using%20regular%20JavaScript%20code.%20Use%20it%20as%20a%20general%20%5C%22text%20transformation%2Fediting%2Fsummarization%2Fetc%5C%22%20tool.%5Cn%2a%20Once%20I%27ve%20given%20the%20user%20some%20custom%20code%2C%20they%20should%20paste%20it%20into%20the%20%5C%22custom%20code%5C%22%20area%20of%20the%20character%20editor.%20It%27s%20in%20the%20advanced%20options.%29%22%2C%22modelName%22%3A%22gpt-3.5-turbo%22%2C%22avatarUrl%22%3A%22https%3A%2F%2Fi.imgur.com%2FZ8NL9u6.jpg%22%2C%22fitMessagesInContextMethod%22%3A%22summarizeOld%22%2C%22associativeMemoryMethod%22%3A%22none%22%2C%22associativeMemoryEmbeddingModelName%22%3A%22text-embedding-ada-002%22%2C%22temperature%22%3A0.7%2C%22customCode%22%3A%22let%20message%20%3D%20%7B%5Cn%20%20content%3A%20%60Please%20wait%20while%20I%20load%20the%20latest%20OpenCharacters%20custom%20code%20documentation.%20%3Cimg%20src%3D%5C%22https%3A%2F%2Fi.imgur.com%2FvbeUYdR.png%5C%22%20style%3D%5C%22height%3A1rem%3Bvertical-align%3Abottom%3B%5C%22%3E%60%2C%5Cn%20%20author%3A%20%5C%22ai%5C%22%2C%5Cn%7D%3B%5Cnoc.thread.messages.push%28message%29%3B%5Cn%5Cnlet%20text%20%3D%20await%20fetch%28%5C%22https%3A%2F%2Fraw.githubusercontent.com%2Fjosephrocca%2FOpenCharacters%2Fmain%2Fdocs%2Fcustom-code.md%5C%22%29.then%28r%20%3D%3E%20r.text%28%29%29%3B%5Cntext%20%3D%20text.replace%28%2F%28%5E%7C%5C%5Cn%29%5B%28USER%7CSYSTEM%7CAI%29%5D%3A%2Fg%2C%20%5C%22%241.%5B%242%5D%3A%5C%22%29%3B%20%2F%2F%20just%20in%20case%20the%20text%20has%20AI%2FUSER%2FSYSTEM%20message%20notation%20within%20it%20for%20whatever%20reason%5Cnoc.character.roleInstruction%20%3D%20%60%5BAI%5D%3A%20%24%7Btext%7D%60%3B%5Cn%5Cnif%28oc.thread.messages.length%20%3E%203%29%20oc.thread.messages.pop%28%29%3B%5Cnelse%20message.content%20%3D%20%5C%22How%20can%20I%20help%20you%3F%5C%22%3B%22%2C%22initialMessages%22%3A%5B%7B%22author%22%3A%22system%22%2C%22content%22%3A%22This%20character%20loads%20the%20%5Bcustom%20code%20docs%5D%28https%3A%2F%2Fgithub.com%2Fjosephrocca%2FOpenCharacters%2Fblob%2Fmain%2Fdocs%2Fcustom-code.md%29%20and%20tries%20to%20help%20you%20write%20custom%20code.%20It%20will%20probably%20make%20lots%20of%20mistakes%20and%20in%20general%20just%20do%20silly%20things.%20Switch%20the%20model%20to%20GPT-4%20if%20you%20can%20afford%20it.%22%2C%22hiddenFrom%22%3A%5B%22ai%22%5D%7D%5D%2C%22creationTime%22%3A1681015133463%2C%22lastMessageTime%22%3A1681015133463%7D%7D`,
];
for(let i = 0; i < starterCharacters.length; i++) {
// convert URL format to object:
Expand Down Expand Up @@ -3399,6 +3401,7 @@
if(
origin.endsWith("jsdelivr.net")
|| (origin.endsWith("huggingface.co") && url.includes("/resolve/"))
|| origin === "https://raw.githubusercontent.com"
) {
return target.call(thisArg, ...argumentsList);
}
Expand All @@ -3410,7 +3413,12 @@
// Note: I was originally trying a normal fetch and then only falling back to this CORS proxy if it failed, but the problem with that is that this would hit the endpoint twice, which may have side effects, and the user might not want that.
// I may eventually have to add manual "exemptions" to skip proxying certain URLs that don't need it - like huggingface models, for example, since we could start to become bandwidth limited.
const proxiedUrl = "https://opencharacters-cors-proxy.joe64.repl.co?url=" + encodeURIComponent(argumentsList[0]);
return target.call(thisArg, proxiedUrl, ...argumentsList.slice(1));
try {
return target.call(thisArg, proxiedUrl, ...argumentsList.slice(1));
} catch(e) {
console.error(e);
return target.call(thisArg, ...argumentsList); // try unproxied if proxied fails
}
},
};
const originalFetch = window.fetch;
Expand Down

0 comments on commit cae5894

Please sign in to comment.