ChatGPT for TiddlyWiki

As the title says, I made a simple ChatGPT plugin where you can customize the parameters and behavior of ChatGPT, but right now it only supports a single round of conversation where he will only answer your last question and not analyze your chat history - I will refine this feature later.

Another reason why it’s called “simple” is that it has no use other than to work in TiddlyWiki. I think it should work better with TiddlyWiki, like analyzing your tiddler. But I don’t have a specific application in mind at the moment.

In addition, you need to register yourself for an openai account and create an API Key, which is required for the plugin to work.

You can download version v0.0.1 from here:

$__plugins_Gk0Wk_chat-gpt.json (16.3 KB)

However, I strongly recommend that you use the CPL for plugin downloads and updates to ensure that the functionality of the plugin is always recent:

7 Likes

@Sttot i tired it out and it working. I tried to use the widget in different tiddlers with seperate state tiddlers to keep the history and it was working. I even tried it with streams and it was working there also, although i had to set the height a bit smaller.

It would be nice to have a clear button next to the chat box or somewhere else to clear the history.

It is now possible to re-edit questions and delete them:

I also added some system events to the widget for easy programming extensions:

For example to play out the answer with TTS technology. @linonetwo might work on it.

1 Like

With Text to Speech widget, use Web Speech synthesis (TTS), free and offline

This seems not working in v0.0.4 , action widget is not invocked.

<$chat-gpt system_message="Say Hello World t">
	<$speech-synthesis text=<<output-text>> />
</$chat-gpt>
1 Like

@Sttot I have noticed the responses are shorter and more to the point when using the API vs. the site. Why is this, and are there parameters that can help with this?

Separately, I had one query produce a bullet list of items that appeared in a single set of paragraph tags. Therefore, new bullets did not appear on a new line. So, I added a CSS style white-space: pre-wrap to resolve. Then, a few minutes later on a different response, it returned bullets in <ul>, rendering my white-space useless. Any ideas why?

Thanks for this.

Directly calling the API will be faster than using the web version of ChatGPT. Additionally, if you want to change the AI’s speaking style and manner, you can define the system_message.

What is System Message

System message is a feature in ChatGPT that allows developers to customize the language style and behavior of the AI response. It is an optional parameter that can be defined when calling the API, which modifies the default behavior of the ChatGPT model while returning the conversational response.

Developers can define specific parameters such as tone, emotions, or specific words to include or exclude from the AI response. This customization provides more control over the conversational flow and allows the developer to tailor the AI response to meet specific needs or use cases.

(Answered by ChatGPT)

The systemMessage used in the sidebar example is as follows:

You known much on TiddlyWiki. You should answer in Markdown format.

This helps to provide a more consistent experience for the user while also freeing up resources for other tasks.

Similarly, by setting the max_tokens parameter, it is possible to limit the length of the ChatGPT’s response. This can help to prevent the AI from going off on tangents or producing excessively long messages that may be difficult for the user to process.

1 Like

Any practical examples?

@Sttot Both of these parameters (token, system message) seemed to addresses my concerns. Thanks.

I failed to save my examples. I have not seen the format issue since adding the parameters.

One more question: I added a button to clear all questions in the history—which does not work. What actions can be put on a button to clear/delete all questions? Thanks again.

@clsturgeon

if you defined the history attribute, just delete the tiddler it points to.

That was one of options I tried. This produced a JS error: uncaught TypeError: cannot read properties of undefined (reading’insertBefore’)

at ChatGPTWidget.render (widget.js2:7068);

This line reads:

t.insertBefore(i, e);

Hi, late to the chatGPT party. When I implement the plugin, I only get a “Thinking…” response, and no response from ChatGPT

@stevesuny I get this too. For me it suggests my api key has expired.