Using ChatGPT with and or about TiddlyWiki

I recently asked a question about HTML

What html tags need not be closed?

then a follow up

are there more?

I got quite a good answer but the html in the answer pasted into tiddlywiki needed

  • Blank lines between numbered items removed
  • Apply the # or numbered bullets to the list items
  • Using the AB button to mark the named tags as code so I could see them

[Edited] Placing \rules except html at the top of the tiddler stopped tiddlywiki attempting to interpret these tags in the content.

  • You can to the same with \rules except wikilink if the content uses camel case you want to hide

I am using GPT for generating short texts and some conceptual models, because I am to lazy entering it manually. For example, GPT can easyily creates simple schemes for DB tables, keys, attributes, etc. I have some TW wiki with iframed GPT (simple iframe to chat) and then manually copy right results to tiddlers.

Can your share the kinds of questions you asked to get useful results?

Have you tried asking gpt to output the wikitext in a code block? In this way you can copy the list more easily.

You need to be specific about your want tiddlywiki wikitext.

I recently also trying to train a custom model that can auto create ui of tw plugin, I may use GitHub issue and discussion and Q&A in the forum (if I can get exported db data, it would be better, than crawl it). I’m using an open source model called chatrwkv.

Here is another example of using ChatGPT to Genrate hybrid HTML and TiddlyWiki code.

Wrap a table in a tiddlywiki list widget

then

Also wrap Row 1 in a list widget

Sure! To wrap Row 1 of the table in a TiddlyWiki list widget, you can modify the previous code as follows:

<$list filter="[tag[Table]]">
  <table>
    <tr>
      <th>Column 1</th>
      <th>Column 2</th>
      <th>Column 3</th>
    </tr>
    <$list filter="[tag[Row1]]">
      <tr>
        <td>Row 1, Column 1</td>
        <td>Row 1, Column 2</td>
        <td>Row 1, Column 3</td>
      </tr>
    </$list>
  </table>
</$list>
  • I deleted row 2

Impresive way to use short text to generate longer code you can use.

2 Likes

See here, I did a few things to generate HTML tables we can use In tiddlywiki Some TiddlyWiki CSS questions - #7 by TW_Tones then later I tried getting it to create tables in TiddlyWiki Table wiki text.

  • It was not perfect so I gave a thumbs down
  • It then asked me what to fix, in this case replace || with | and it did so.
  • Insubsequent texts it worked for exaple;

Generate a tiddlywiki table with the columns needed for an invoice

Sure, here’s an example of a TiddlyWiki table with the columns needed for an invoice:

|! Date       |! Description                 |! Quantity |! Unit Price |! Total |
| 2023-03-26 | Website design and hosting   | 1         | 1000.00     | 1000.00 |
| 2023-03-27 | Social media marketing       | 3         | 500.00      | 1500.00 |
| 2023-03-28 | Logo design                  | 1         | 800.00      | 800.00  |
| 2023-03-29 | Copywriting                  | 2         | 300.00      | 600.00  |
| 2023-03-30 | Photography and video        | 1         | 1200.00     | 1200.00 |
|            |                              |           | **Total**   | **5100.00** |

In this example, the table has five columns:

  • Date: The date the item was billed.
  • Description: A brief description of the item or service.
  • Quantity: The quantity of the item or service billed.
  • Unit Price: The unit price of the item or service.
  • Total: The total amount billed for the item or service.

The last row of the table is used to calculate the total amount billed for all items or services. The total row is created by leaving the first cell of the row empty, and using bold formatting to indicate that it is a total row.

You can copy and paste this code into a TiddlyWiki tiddler, and the table will be rendered as HTML in the view mode of the tiddler.

Wow!

1 Like

I got access to Google’s Bard this morning. I asked it about TiddlyWiki and then asked it to solve an issue that has got me stumped. Haven’t asked in here before as I’m sure the answer is obvious and I’ve missed it somewhere.

ME:
What do you know about the software called TiddlyWiki?

TiddlyWiki is a personal wiki and non-linear notebook for organizing and sharing complex information. It is an open-source single page application wiki in the form of a single HTML file that includes CSS, JavaScript, embedded files such as images, and the text content. It is designed to be easy to customize and re-shape depending on application. It facilitates re-use of content by dividing it into small pieces called Tiddlers. Multilingual, over 30 languages in TiddlyWiki 5.1. 23.

TiddlyWiki is an unusual example of a practical quine. This idea of producing a copy of its own source code that lies at the heart of TiddlyWiki’s ability to independently save changes to itself. Quine is also the name of the unofficial TiddlyWiki application for iPhone/iPad.

TiddlyWiki is a powerful tool that can be used for a variety of purposes, such as:

Taking notes
Organizing information
Creating a personal knowledge base
Sharing information with others
Creating a blog
Creating a website

TiddlyWiki is a versatile tool that can be used by anyone, from students and professionals to artists and writers. It is a great way to keep track of information and to organize your thoughts.
Sources - Learn more

en.wikipedia.org/wiki/TiddlyWiki 

Search related topics
ME:
Do you know how to make a table of information in a TiddlyWiki Tiddler?

Yes, I do know how to make a table of information in a TiddlyWiki Tiddler. To do this, you can use the following syntax:

! Title of the table

Header 1 Header 2
Value 1 Value 2
Value 3 Value 4

This will create a table with three columns and four rows. The first row will contain the headers, and the remaining rows will contain the values. You can then add more rows and columns as needed.

Here is an example of a table of information in a TiddlyWiki Tiddler:

! My Table

Name Age Location
John 30 New York
Mary 25 London
Peter 20 Paris

This table can be used to store information about people, places, or anything else. It can also be used to create a list of items, such as a grocery list or a to-do list.
ME:
Can a table be created from other tiddler fields. For example. If I had a series Tiddlers with a tag ‘People’ in each of them and each tiddler had fields for Name, Age, and Location; can a table be created that uses the information from these fields of all tiddlers with the tag ‘People’?

Yes, a table can be created from other tiddler fields. To do this, you can use the following formula:

! Table of People

Name Age Location
{{ [[People Name]] }} {{ [[People

This formula will create a table with three columns and one row for each tiddler that has the tag ‘People’. The first column will contain the name of the person, the second column will contain their age, and the third column will contain their location.

Here is an example of a table of people created from other tiddler fields:

! Table of People

Name Age Location
John 30 New York
Mary 25 London
Peter 20 Paris

This table can be used to easily find information about the people in your TiddlyWiki.
ME:
Thanks. I will try this shortly. I will get back to you later. I have a few other things I need to do now.

You’re welcome! I am glad I could be of assistance. Please feel free to ask me any other questions you may have.
ME:
Unfortuantly your code didn’t work. It just displays as

Table of People
Name Age Location
:—: :—: :—:
{{ People }} {{ People }} {{ People }}
I apologize that my code did not work. I am still under development, and I am always learning. I will try my best to help you with your TiddlyWiki needs.

Here is a possible explanation for why my code did not work:

The tag People is not defined in your TiddlyWiki.
The fields Name, Age, and Location are not defined in your TiddlyWiki.
You are using the wrong formula.

If you are still having trouble, please feel free to ask me for help. I will try my best to assist you.

1 Like

Your code isn’t displaying properly (try surrounding it with backticks as per the preformatted text style), but from what I can see, I’m afraid it’s quite off-base. I think you’re looking for something more like this:

<table>
<tr>
<th>Name</th>
<th>Age</th>
<th>Location</th>
</tr>
<$list filter="[tag[People]]">
<tr>
<td>{{!!title}}</td>
<td>{{!!age}}</td>
<td>{{!!location}}</td>
</tr>
</$list>
</table>

Notes:

  • I can’t tell whether the AI gave you a valid TW table or not since the code is being rendered by the Discourse parser, but looking at :—: :—: :—:, I suspect not. Wikitext doesn’t use colons like that.
  • I’m also not sure whether it used a list widget, but you need one to collect all the tiddlers with the People tag. I put it inside the table and after the the header row because we want one row per person, not one table per person. (I’m also using HTML rather than wikitext to generate the table because it’s much easier when working with lists.)
  • To populate each row, you’ll need field transclusions. I used {{!!title}} in the first cell on the assumption that the name of the tiddler is the name of the person, but if you’re using a different naming scheme, you could use {{!!caption}} or even {{!!name}} instead.
  • {{!!age}} and {{!!location}} take their values from the “age” and “location” fields of each “People” tiddler.

I’d be interested to see the code it did give you! I’d definitely take any output with a generous grain of salt, though: the issue with AI chatbots is that they tend to be very confidently wrong.

3 Likes

Thanks etardiff. Your code worked great.

I noticed what the AI gave me didn’t quite match what dispalyed in my comment but it didn’t make use of transclusions.

I’ve had similar code experience with ChatGTP working with Windows Command Line code. It looked nice but didn’t quite work and it was unable to fix it after multiple attempts.

Looking forward to how both of these develop over time.

I just asked ChatGPT (V4 to be exact) “can you give me your last answer in tiddlywiki markup”

It uses correct link and bullet markup

Of course! Here is the previous answer in TiddlyWiki markup format, which includes bullet points and external links:

* [[National Institute of Standards and Technology (NIST)|https://www.nist.gov/pml/atomic-spectroscopy-databases]]: The NIST provides various databases for different parts of the electromagnetic spectrum, including atomic spectra, molecular spectra, and X-ray spectra.

* [[NASA's Goddard Space Flight Center|https://science.gsfc.nasa.gov/ast/uvvisible/spectrum]]: NASA's Goddard Space Flight Center has a few databases related to the electromagnetic spectrum, such as UV, visible, and infrared data.

* [[HITRAN Database|https://hitran.org]]: The HITRAN (HIgh-resolution TRANsmission molecular absorption) database contains high-resolution spectroscopic data for various molecules in the infrared, visible, and ultraviolet regions of the spectrum.

* [[Splatalogue Database|https://splatalogue.online]]: Splatalogue is a comprehensive database of spectral lines from various molecules, covering radio and microwave frequencies. This can be helpful if you are looking for data in that specific range of the electromagnetic spectrum.

While these sources do not cover the entire electromagnetic spectrum, they offer a good starting point for your research. Please note that you may need to register or request access to some of these resources, and the format of the data may vary depending on the source.

Simply copy and paste this text into a Tiddler within your TiddlyWiki, and it should display the content with the proper formatting, including bullet points and clickable links.

1 Like

But then I asked “Could you place the title and text in a tiddlywiki table format”

  • I did not want the content centred so I asked “please remove spaces around |”.

Here is the visual result

You can see how ChatGPT is an editors or authors assistant.

You would need to tell it the difference about TW table syntax first … and than ask again.

I did try to tell it:

|Left aligned content |

has no space between the leading | character and the following text

| Right aligned content|

has a space after the first | and has no space before the next |

| Centred content |

has a leading a trailing space

And then I asked

So can you show me an example table using tiddlywiki wikitext syntax where headers are centered and text is left aligned?

The answer was a markdown-like table … but I’m using chatGPT 3.5. …

So it would be interesting if you could tell v4 the right syntax and than ask again.

I did an other test like so:

Copy paste the whole content from: https://tiddlywiki.com/#Tables%20in%20WikiText into the user text box. With a preamble like: “TW syntax descriptions is this:” following by the text copied from the link

Then I asked again:

“So can you show me an example table using tiddlywiki wikitext syntax where headers are centered and text is left aligned?”

I got the answer:

Sure, here’s an example table where the header cells are centered and the data cells are left aligned:

|!^Header 1 |!^Header 2 |
|Left aligned content |Left aligned content |
|Another left aligned content |Another left aligned content |

This will create a table with two columns and two rows of data, where the header cells are centered and the data cells are left aligned. Note that the ! character before the header cells indicates that they are header cells, and the ^ character before the first header cell indicates that it should be vertically aligned to the top.


So the top-alignment for the header is not right, but the text formatting is right now. …

1 Like

Independently of tiddlywiki, and like I expected many others, I am researching how I can make full use of such technology. At this point in my research it is proving to be very useful.

My key observations are;

  • maintain scepticism of the output
  • learning what questions and how to ask questions, is the key to identifying its value
  • prompting or priming the system is also helpful
  • don’t accept poor answers. Provide feedback
2 Likes

Another example of ChatGPT, where I created a bookmarklet for setting the window name of a tab Bookmarklets, Just in Time install, Windows work flow and Timimi - #8 by TW_Tones

Wow

I returned to ChatGPT4 and asked this; The answer possibly stolen from one of our members, but I created it and it worked.

There is a standard way to write the javascript for filter functions in tiddlywiki, can you help me write one?

Certainly! In TiddlyWiki, a filter is a sequence of steps that select a set of tiddlers from the entire wiki. Each step in a filter can transform the current set of titles by adding to it, removing from it, or otherwise changing it.

To write a filter function in TiddlyWiki using JavaScript, you would typically create a JavaScript macro or a plugin that defines a new filter operator.

Here’s a basic outline of steps to create a custom filter function in TiddlyWiki:

  1. Define a JavaScript Macro or Plugin: Create a new tiddler with a type of application/javascript.
  2. Create a Filter Function: Define a function that will act as your filter. The function should accept an operand (if your filter operator requires one), an array of titles to filter, and an optional callback function for a run prefix.
  3. Register the Filter Operator: Use the $tw global object to register your filter function as a new filter operator.
  4. Use the Filter: Once the operator is registered, you can use your new filter in filter expressions anywhere in your TiddlyWiki.

Here’s a simple example of a filter operator that filters tiddlers by checking if their title includes a certain string:

/*\
title: $:/plugins/myusername/myfilteroperator.js
type: application/javascript
module-type: filteroperator

\*/

(function(){

/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";

/*
Export our filter function
*/
exports.myfilter = function(source, operator, options) {
    // operator.operand is the text that the filter operator is being applied with
    var text = operator.operand.toLowerCase();
    // operator.prefix determines if it's a negation
    var invert = operator.prefix === "!";
    // source is the list of tiddler titles being filtered
    var results = [];
    source(function(tiddler,title) {
        if(title && title.toLowerCase().indexOf(text) !== -1 !== invert) {
            results.push(title);
        }
    });
    return results;
};

})();

This code defines a filter operator named myfilter that includes tiddlers if their title includes the given operand text.

To use this new filter, you’d add your operand in a filter run like this:

[myfilter[searchText]]

Or to use the negation:

[!myfilter[searchText]]

Make sure to replace searchText with the actual text you want to filter by.

Please note that you should be comfortable with JavaScript and familiar with the TiddlyWiki development environment before attempting to create custom filters. Also, ensure to test your filters carefully to ensure they work as expected within your TiddlyWiki environment.

now to test if it can modify this to perform more sophisticated functions

Just an update, I made a number of filters that worked quickly and easily,

  • total fieldname given a fieldname will sum all input tiddler titles fieldname field
  • totalcost, which if given two fieldnames will multiply one by the other an sum them all

This can off course be achieved with regular filters and or functions but they are useful for simplication purposes.

What is an operator you would like to see?

I think we need a thread with curated one-liners.

Maybe AI could help us write TiddlyWiki documentation that is lacking?

There has been new releases of the LLM used for ChatGPT that can be provided documents to ingest and provide feedback and information on.

If one were to build one of these LLM and feed it individual tiddlers from TiddlyWiki.com, it would likely be able to provide accurate information and list areas that could use further elaboration and suggest areas that require further documentation.

I was just watching a YT video regarding this yesterday, I believe a new version was just released that functions very well. Edit: a YT video just on llm’s sadly no one has begun making a tiddlywiki specific gpt model :pensive: