Code Generation Tool#718
Conversation
✅ Deploy Preview for thingweb-playground ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
egekorkan
left a comment
There was a problem hiding this comment.
Initial review based on git diff
- Netlify previews are failing due to dependencies. Not sure how the CI tests are passing if the problem is so basic :D
- For the tests, did you also do tests with a live Thing? like your coffee machine example or http://plugfest.thingweb.io/http-data-schema-thing ?
869d86c to
39bae0d
Compare
egekorkan
left a comment
There was a problem hiding this comment.
- Web package is working nicely.
- CLI:
- tsx as a dependency is missing
- Modbus and javascript is not working? Or is the base not used to detect protocol?
- When the output prompt step comes and I put a path,
~/Downloadsdoes not work
However, given that the CLI will live in td-tools, we can still go ahead and fix the issues in the commits to that repo
be40612 to
66470ea
Compare
Could you please share your inputs? Modbus serial works fine for me. |
The path input was only relative. I added support for absolute path inputs and an interactive mode for selecting the file or folder to ease the input. Could you test that again please? |
This is working. Modbus in Javascript with the following TD does not work. It is generated from https://github.com/wot-oss/thingmodels/blob/main/siemens/siemens/3nacom-fuse/v1.0.0-20240802121832-3b18ae135fbc.tm.json but use the attachment. The generation results in a prompt even though we have modbus binding |
|
@egekorkan I have refactored the code and improved the protocol detection. Now it should work fine. |
ab66335 to
3996fe6
Compare
|
I think the feature is ready to move to the td-tools and further improvements can be done there. I still see some frictions like fetch showing up even for modbus but that can be an improvement. @bobur-khay can you make a PR with only the core tooling in td-tools? |
|
It was only in Playground so it is fine for now :) |
|
Copied the package to eclipse-thingweb/td-tools#77 Will remove it from this PR once the other one is merged |
|
@bobur-khay the package is published at https://www.npmjs.com/package/@thingweb/code-gen |
|
There was a publish problem for the code-gen package. Fixed it here eclipse-thingweb/td-tools#80 |
844226c to
12390e5
Compare
12390e5 to
c8708bf
Compare
|
Ready for final review |
egekorkan
left a comment
There was a problem hiding this comment.
Also some basic tests are needed. the actual tool is ofc tested in td-tools but would be nice to test if the console gets populated with code
| "@thingweb/td-utils": "^1.0.0", | ||
| "d3": "^3.5.17", | ||
| "d3-tip": "^0.6.7", | ||
| "express": "^4.22.2", |
There was a problem hiding this comment.
could you make sure that this "regression" is needed?
There was a problem hiding this comment.
Looks like a merge-conflict error, reversed it
Tests added |


This is a take over of PR: eclipse-thingweb/td-tools#61
The goal is to create a package of a code generation tool that creates a protocol specific code snippet in a chosen library of a programming language and integrate it to the playground.
Taking over the previous PR I could not make it run and had a different vision of the use of AI generation:
The Bring Your Own Token principal requires the playground of either:
In both cases the user needs a developer account in their respective LLM provider and has to know how to generate the token which reduces UX imo. Therefore, after discussing this with @egekorkan I implemented another concept where the tool generates a prompt that user can paste in an LLM of their own choice:
The tool is inside of this repository for now for testing purposes. Later it can be moved to the
td-toolsrepository.