Spaces:
Running
Running
owenkaplinsky
commited on
Commit
·
d2d911c
1
Parent(s):
c54bef9
Update weather example
Browse files- project/src/generators/python.js +1 -1
- project/src/index.js +2 -2
project/src/generators/python.js
CHANGED
|
@@ -341,7 +341,7 @@ forBlock['in_json'] = function (block, generator) {
|
|
| 341 |
const json = generator.valueToCode(block, 'JSON', Order.NONE);
|
| 342 |
|
| 343 |
// Generate code to call an LLM model with a prompt
|
| 344 |
-
const code = `${json}[
|
| 345 |
return [code, Order.NONE];
|
| 346 |
};
|
| 347 |
|
|
|
|
| 341 |
const json = generator.valueToCode(block, 'JSON', Order.NONE);
|
| 342 |
|
| 343 |
// Generate code to call an LLM model with a prompt
|
| 344 |
+
const code = `${json}[${name}]`;
|
| 345 |
return [code, Order.NONE];
|
| 346 |
};
|
| 347 |
|
project/src/index.js
CHANGED
|
@@ -191,7 +191,7 @@ cancelApiKeyButton.addEventListener("click", () => {
|
|
| 191 |
apiKeyModal.style.display = 'none';
|
| 192 |
});
|
| 193 |
|
| 194 |
-
const weatherText =
|
| 195 |
weatherButton.addEventListener("click", () => {
|
| 196 |
try {
|
| 197 |
const fileContent = JSON.parse(weatherText);
|
|
@@ -586,7 +586,7 @@ const setupUnifiedStream = () => {
|
|
| 586 |
testBlock.dispose(true); // Remove the test block
|
| 587 |
|
| 588 |
if (isValueBlock) {
|
| 589 |
-
throw new Error(`Cannot place value block '${blockType}' under a statement block. Value blocks must be nested inside inputs of other blocks or placed in MCP outputs using type: "input".`);
|
| 590 |
}
|
| 591 |
}
|
| 592 |
|
|
|
|
| 191 |
apiKeyModal.style.display = 'none';
|
| 192 |
});
|
| 193 |
|
| 194 |
+
const weatherText = '{"workspaceComments":[{"height":80,"width":477,"id":"XI5[EHp-Ow+kinXf6n5y","x":52.674375,"y":-52.760000000000005,"text":"Gets temperature of location with a latitude and a longitude."}],"blocks":{"languageVersion":0,"blocks":[{"type":"create_mcp","id":")N.HEG1x]Z/,k#TeWr,S","x":50,"y":50,"deletable":false,"extraState":{"inputCount":2,"inputNames":["latitude","longitude"],"inputTypes":["string","string"],"outputCount":1,"outputNames":["output0"],"outputTypes":["string"],"toolCount":0},"inputs":{"X0":{"block":{"type":"input_reference_latitude","id":"]3mj!y}qfRt+!okheU7L","deletable":false,"extraState":{"ownerBlockId":")N.HEG1x]Z/,k#TeWr,S"},"fields":{"VARNAME":"latitude"}}},"X1":{"block":{"type":"input_reference_longitude","id":"Do/{HFNGSd.!;POiKS?D","deletable":false,"extraState":{"ownerBlockId":")N.HEG1x]Z/,k#TeWr,S"},"fields":{"VARNAME":"longitude"}}},"R0":{"block":{"type":"in_json","id":"R|j?_8s^H{l0;UZ-oQt3","inputs":{"NAME":{"block":{"type":"text","id":"@Z+@U^@8c0gQYj}La`PY","fields":{"TEXT":"temperature_2m"}}},"JSON":{"block":{"type":"in_json","id":"X=M,R1@7bRjJVZIPi[qD","inputs":{"NAME":{"block":{"type":"text","id":"OMr~`#kG$3@k`YPDHbzH","fields":{"TEXT":"current"}}},"JSON":{"block":{"type":"call_api","id":"^(.vyM.yni08S~c1EBm=","fields":{"METHOD":"GET"},"inputs":{"URL":{"shadow":{"type":"text","id":"}.T;_U_OsRS)B_y09p % { ","fields":{"TEXT":""}},"block":{"type":"text_replace","id":"OwH9uERJPTGQG!UER#ch","inputs":{"FROM":{"shadow":{"type":"text","id":"ya05#^ 7 % UbUeXX#eDSmH","fields":{"TEXT":"{latitude}"}},"block":{"type":"text","id":"6CX#+wo9^x+vZ`LRt5ms","fields":{"TEXT":"{latitude}"}}},"TO":{"shadow":{"type":"text","id":": _ZloQuh9c-MNf-U]!k5","fields":{"TEXT":""}},"block":{"type":"input_reference_latitude","id":"?%@)3sErZ)}=#4ags#gu","extraState":{"ownerBlockId":")N.HEG1x]Z/,k#TeWr,S"},"fields":{"VARNAME":"latitude"}}},"TEXT":{"shadow":{"type":"text","id":"w@zsP)m6:WjkUp,ln3$x","fields":{"TEXT":""}},"block":{"type":"text_replace","id":"ImNPsvzD7r^+1MJ%IirV","inputs":{"FROM":{"shadow":{"type":"text","id":"%o(3rro?WLIFpmE0#MMM","fields":{"TEXT":"{longitude}"}},"block":{"type":"text","id":"`p!s8dQ7e~?0JvofyB-{","fields":{"TEXT":"{longitude}"}}},"TO":{"shadow":{"type":"text","id":"Zpql-%oJ_sdSi | r |* er | ","fields":{"TEXT":""}},"block":{"type":"input_reference_longitude","id":"WUgiJP$X + zY#f$5nhnTX","extraState":{"ownerBlockId":") N.HEG1x]Z /, k#TeWr, S"},"fields":{"VARNAME":"longitude"}}},"TEXT":{"shadow":{"type":"text","id":", (vw$o_s7P = b4P; 8]}yj","fields":{"TEXT":"https://api.open-meteo.com/v1/forecast?latitude={latitude}&longitude={longitude}¤t=temperature_2m,wind_speed_10m"}}}}}}}}}}}}}}}}}}}}]}}';
|
| 195 |
weatherButton.addEventListener("click", () => {
|
| 196 |
try {
|
| 197 |
const fileContent = JSON.parse(weatherText);
|
|
|
|
| 586 |
testBlock.dispose(true); // Remove the test block
|
| 587 |
|
| 588 |
if (isValueBlock) {
|
| 589 |
+
throw new Error(`Cannot place value block '${blockType}' under a statement block. Value blocks must be nested inside inputs of other blocks or placed in MCP outputs using type: "input". Try creating a variable and assigning the value to that.`);
|
| 590 |
}
|
| 591 |
}
|
| 592 |
|