Hi all!
I’m trying to implement a workflow that depends on an external library. I used @raydeck 's awesome tool https://weweb-embed.statechange.ai/ and method to add the import statement on page load, and I have custom JS in a workflow action to call a function from the imported library.
Here’s where things get weird: the code I am trying to run works perfectly as expected in my VS Code live server. Here it is:
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers';
// Create text generation pipeline
const generator = await pipeline('text2text-generation', 'Xenova/LaMini-Flan-T5-783M');
// Define the prompt and list of messages
const prompt = "Tell me a funny joke."
// Generate text
const output = await generator(prompt, { max_new_tokens: 100 });
console.log(output);
When I try it in WeWeb though, my on page load workflow runs successfully but when I click the button that triggers the custom JS workflow, I get this error:
name: "SyntaxError"
stack: "SyntaxError: Unexpected token '<', ") at h (https://cdn.jsdelivr.net/npm/@xenova/transformers:100:6827) at async Promise.all (index 0) at async c (https://cdn.jsdelivr.net/npm/@xenova/transformers:82:1508) at async lt.from_pretrained (https://cdn.jsdelivr.net/npm/@xenova/transformers:82:44884) at async Promise.all (index 0) at async https://cdn.jsdelivr.net/npm/@xenova/transformers:76:22204 at async R (https://cdn.jsdelivr.net/npm/@xenova/transformers:76:21885) at async eval (eval at executeCode (https://editor-cdn.weweb.io/ww_front/public/js/index.697ae9af.js:1:370508), :2:19) at async executeCode (https://editor-cdn.weweb.io/ww_front/public/js/index.697ae9af.js:1:370502)"
message: "Unexpected token '<', "
Does anyone have an idea of what might be causing this error?
Thanks!
GD