Skip to content

Commit

Permalink
1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
TfTHacker committed Apr 5, 2024
1 parent 81d148d commit ef3777d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 33 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "ai-templater",
"name": "AI for Templater",
"version": "1.0.7",
"version": "1.0.8",
"minAppVersion": "1.5.11",
"description": "AI Extension for the Templater plugin with the OpenAI Client Library.",
"author": "TfTHacker",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "openaisdk",
"version": "1.0.7",
"description": "OpenAI SDK plugin for Obsidian.",
"version": "1.0.8",
"description": "AI for Templater plugin for Obsidian.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
Expand All @@ -17,7 +17,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/TfTHacker/openai-sdk-obsidian.git"
"url": "git://github.com/TfTHacker/obsidian-ai-templater"
},
"devDependencies": {
"@html-eslint/eslint-plugin": "^0.24.0",
Expand Down
18 changes: 2 additions & 16 deletions src/settings/Promotional.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
export const promotionalLinks = (containerEl: HTMLElement, settingsTab = true): HTMLElement => {
export const promotionalLinks = (containerEl: HTMLElement): HTMLElement => {
const linksDiv = containerEl.createEl('div');
linksDiv.style.float = 'right';

if (!settingsTab) {
linksDiv.style.padding = '10px';
linksDiv.style.paddingLeft = '15px';
linksDiv.style.paddingRight = '15px';
} else {
linksDiv.style.padding = '15px';
linksDiv.style.paddingLeft = '15px';
linksDiv.style.paddingRight = '15px';
linksDiv.style.marginLeft = '15px';
}

linksDiv.classList.add('ait-promotional-links');
const twitterSpan = linksDiv.createDiv('coffee');
twitterSpan.addClass('ex-twitter-span');
twitterSpan.style.paddingLeft = '10px';
const captionText = twitterSpan.createDiv();
captionText.innerText = 'Learn more about my work at:';
twitterSpan.appendChild(captionText);
const twitterLink = twitterSpan.createEl('a', { href: 'https://tfthacker.com' });
twitterLink.innerText = 'https://tfthacker.com';

return linksDiv;
};
10 changes: 5 additions & 5 deletions src/settings/SettingsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ export class OWlSettingTab extends PluginSettingTab {
await this.plugin.saveData(this.plugin.settings);
});
textEl.inputEl.rows = 6;
if (Platform.isIosApp) textEl.inputEl.style.width = '100%';
else if (Platform.isDesktopApp) {
textEl.inputEl.rows = 6;
}
// if (Platform.isIosApp) textEl.inputEl.style.width = '100%';
// else if (Platform.isDesktopApp) {
// textEl.inputEl.rows = 6;
// }
});

promotionalLinks(containerEl, true);
promotionalLinks(containerEl);
containerEl.createEl('hr');

containerEl.createEl('h1', { text: 'Debugging' });
Expand Down
16 changes: 11 additions & 5 deletions src/templater/InternalModuleAit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type AitPlugin from '../main';
import { InternalModule } from 'templater-obsidian/src/core/functions/internal_functions/InternalModule';
import type { ModuleName } from 'templater-obsidian/src/editor/TpDocumentation';
import type { ChatCompletionMessageParam } from 'openai/resources';
import type { TFile } from 'obsidian';
import { TFile } from 'obsidian';
import ActivityIndicator from '../utils/ActivityIndicator';

export class InternalModuleAit extends InternalModule {
Expand Down Expand Up @@ -47,10 +47,16 @@ export class InternalModuleAit extends InternalModule {
}

async generate_content_without_properties(): Promise<string> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- target_file is a TFile
const file = this.config.target_file as TFile;
const fileContents = await this.plugin?.app.vault.read(file);
return fileContents ? fileContents.replace(/^---\n([\s\S]*?)\n---\n/, '') : '';
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- target_file is a valid property
if (this.config.target_file instanceof TFile) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- target_file is a valid property
const file = this.config.target_file;
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- target_file is a valid property
const fileContents = await this.plugin?.app.vault.read(file);
return fileContents ? fileContents.replace(/^---\n([\s\S]*?)\n---\n/, '') : '';
} else {
throw new Error('target_file is not a TFile');
}
}

generate_run_chat(): (
Expand Down
13 changes: 11 additions & 2 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
width: 100%;
}

/* Promotional Links */
.ait-promotional-links {
float: right;
padding: 15px;

}

/* Spinkit https://github.com/tobiasahlin/SpinKit?tab=readme-ov-file */
.ait-spinner {
width: 20px;
position: absolute;
right: 10px;
}

.ait-spinner > div {
.ait-spinner>div {
width: 20px;
height: 10px;
background-color: var(--background-modifier-border-focus);
Expand All @@ -32,12 +39,14 @@
}

@keyframes oil-sk-bouncedelay {

0%,
80%,
100% {
transform: scale(0);
}

40% {
transform: scale(1);
}
}
}
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"1.0.4": "1.5.11",
"1.0.5": "1.5.11",
"1.0.6": "1.5.11",
"1.0.7": "1.5.11"
"1.0.7": "1.5.11",
"1.0.8": "1.5.11"
}

0 comments on commit ef3777d

Please sign in to comment.