Skip to content

Commit

Permalink
fix: file path
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Nov 20, 2024
1 parent 373a7e5 commit 017ea8d
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 80 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@ You can join the project in [Paratranz](https://paratranz.cn/projects/12129), an
## How to run

1. Have [Deno](https://deno.com/) installed
1. Get a [DeepSeek API key](https://platform.deepseek.com/api_keys) or OpenAI API key, put it in a `.env` file, copied from [.env.template](./.env.template) file.
1. Run `deno task dev`
1. Clone this project and TiddlyWiki5 repo side by side in a folder.
1. "cd" into this project's folder
1. Get a [DeepSeek API key](https://platform.deepseek.com/api_keys) or OpenAI API key, put it in a `.env` file, copied from [.env.template](./.env.template) file.
1. Run `deno task dev`
38 changes: 0 additions & 38 deletions data/EditTemplate.20241120.chatml

This file was deleted.

40 changes: 40 additions & 0 deletions data/TiddlyWiki5/core/wiki/config/ui/EditTemplate.20241120.chatml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<|im_start|>system

<|im_end|>
<|im_start|>user
title: $:/config/ui/EditTemplate
text: $:/core/ui/EditTemplate

<|im_end|>
<|im_start|>assistant
`wikitext
title: $:/config/ui/EditTemplate

This line specifies the title of the tiddler. In TiddlyWiki, a tiddler is a basic unit of information, similar to a document or a page. The title of this tiddler is $:/config/ui/EditTemplate. The title is prefixed with $:/, which indicates that this tiddler is part of the core configuration or system settings of the TiddlyWiki.

wikitext
text: $:/core/ui/EditTemplate

This line sets the text content of the tiddler. The text is a reference to another tiddler, specifically $:/core/ui/EditTemplate. This means that the content of this tiddler is sourced from the tiddler with the title $:/core/ui/EditTemplate. Essentially, this tiddler is acting as a pointer or alias to the core UI edit template, allowing it to be used or referenced elsewhere in the wiki.
<|im_end|><|im_start|>system

<|im_end|>
<|im_start|>user
What does this mean?
`tid
<<inputWikiText>>

<|im_end|>
<|im_start|>assistant
<<aIOutput>>
<|im_end|><|im_start|>system
You are a helpful TiddlyWiki community member, you want to help new users write WikiText and tiddler fields for their wiki or TW plugins.
<|im_end|>
<|im_start|>user
The user might ask:

"Can you generate a WikiText block with metadata at the top, where the title is set to $:/config/ui/EditTemplate and the text is set to $:/core/ui/EditTemplate?", with metadata
<|im_end|>
<|im_start|>assistant

<|im_end|>
40 changes: 40 additions & 0 deletions data/TiddlyWiki5/core/wiki/config/ui/ViewTemplate.20241120.chatml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<|im_start|>system

<|im_end|>
<|im_start|>user
title: $:/config/ui/ViewTemplate
text: $:/core/ui/ViewTemplate

<|im_end|>
<|im_start|>assistant
`wikitext
title: $:/config/ui/ViewTemplate

This line specifies the title of the tiddler. In TiddlyWiki, a tiddler is a basic unit of information, and its title is used to uniquely identify it. Here, the title is set to $:/config/ui/ViewTemplate, which indicates that this tiddler is a configuration related to the user interface (UI) and specifically to the view template.

wikitext
text: $:/core/ui/ViewTemplate

This line sets the text content of the tiddler. The text is a reference to another tiddler, specifically $:/core/ui/ViewTemplate. This means that the content of this tiddler is essentially a pointer or a reference to the content of the $:/core/ui/ViewTemplate tiddler. This is a common pattern in TiddlyWiki where one tiddler can inherit or reference the content of another tiddler.
<|im_end|><|im_start|>system

<|im_end|>
<|im_start|>user
What does this mean?
`tid
<<inputWikiText>>

<|im_end|>
<|im_start|>assistant
<<aIOutput>>
<|im_end|><|im_start|>system
You are a helpful TiddlyWiki community member, you want to help new users write WikiText and tiddler fields for their wiki or TW plugins.
<|im_end|>
<|im_start|>user
The user might ask:

"Can you generate a WikiText block with metadata at the top? The title should be $:/config/ui/ViewTemplate and the text should be $:/core/ui/ViewTemplate.", with metadata
<|im_end|>
<|im_start|>assistant

<|im_end|>
38 changes: 0 additions & 38 deletions data/ViewTemplate.20241120.chatml

This file was deleted.

7 changes: 5 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { generateChatML } from "./generateChatML.ts";

async function readTidFilesAndCreateChatML(folderPath: string) {
const dataFolderPath = join(Deno.cwd(), "data");
const basePath = join(Deno.cwd(), "..");
const currentDate = new Date().toISOString().split("T")[0].replace(/-/g, "");

async function processFolder(currentPath: string) {
Expand All @@ -14,10 +15,12 @@ async function readTidFilesAndCreateChatML(folderPath: string) {
const statResult = await Deno.stat(fullPath);

if (extname(file.name) === ".tid") {
const relativePath = relative(folderPath, fullPath);
const fileName = relative(folderPath, fullPath);
const relativePath = relative(basePath, currentPath);
const chatmlFilePath = join(
dataFolderPath,
relativePath.replace(".tid", `.${currentDate}.chatml`),
relativePath,
fileName.replace(".tid", `.${currentDate}.chatml`),
);

try {
Expand Down

0 comments on commit 017ea8d

Please sign in to comment.