remove obsidian naming

This commit is contained in:
ransurf 2023-12-12 17:55:37 -08:00
parent 233b27b00b
commit 76b4c70a79
5 changed files with 13 additions and 27 deletions

28
main.ts
View File

@ -1,5 +1,5 @@
import { App, Plugin, PluginSettingTab, Setting } from 'obsidian';
import { AppView, OBSIDIAN_INTELLIGENCE_VIEW_TYPE } from './src/ui/AppView';
import { AppView, INTELLIGENCE_VIEW_TYPE } from './src/ui/AppView';
import OpenAI from 'openai';
import { IThread } from './src/ui/types';
@ -25,25 +25,11 @@ export default class Intelligence extends Plugin {
async onload() {
await this.loadSettings();
this.registerView(OBSIDIAN_INTELLIGENCE_VIEW_TYPE, (leaf) => new AppView(leaf, this));
const ribbonIconEl = this.addRibbonIcon(
'bot',
'Open Obsidian Intelligence',
(evt: MouseEvent) => {
this.activateView();
},
);
// Perform additional things with the ribbon
ribbonIconEl.addClass('my-plugin-ribbon-class');
// This adds a status bar item to the bottom of the app. Does not work on mobile apps.
const statusBarItemEl = this.addStatusBarItem();
statusBarItemEl.setText('Status Bar Text');
this.registerView(INTELLIGENCE_VIEW_TYPE, (leaf) => new AppView(leaf, this));
this.addCommand({
id: 'obsidian-intelligence-view-open',
name: 'Open Obsidian Intelligence',
id: 'intelligence-view-open',
name: 'Open Intelligence',
callback: () => {
this.activateView();
},
@ -68,10 +54,10 @@ export default class Intelligence extends Plugin {
}
async activateView() {
this.app.workspace.detachLeavesOfType(OBSIDIAN_INTELLIGENCE_VIEW_TYPE);
this.app.workspace.detachLeavesOfType(INTELLIGENCE_VIEW_TYPE);
await this.app.workspace.getRightLeaf(false).setViewState({
type: OBSIDIAN_INTELLIGENCE_VIEW_TYPE,
type: INTELLIGENCE_VIEW_TYPE,
active: true,
});
@ -79,7 +65,7 @@ export default class Intelligence extends Plugin {
}
async revealView() {
this.app.workspace.revealLeaf(
this.app.workspace.getLeavesOfType(OBSIDIAN_INTELLIGENCE_VIEW_TYPE)[0],
this.app.workspace.getLeavesOfType(INTELLIGENCE_VIEW_TYPE)[0],
);
}
}

View File

@ -3,7 +3,7 @@
"name": "Intelligence",
"version": "1.0.0",
"minAppVersion": "0.15.0",
"description": "OpenAI GPT Assistants functionality inside Obsidian",
"description": "Integrate OpenAI GPT Assistants functionality",
"author": "John Mavrick",
"authorUrl": "https://beacons.ai/johnmavrick",
"fundingUrl": "https://patreon.com/johnmavrick",

View File

@ -1,7 +1,7 @@
{
"name": "obsidian-intelligence",
"version": "1.0.0",
"description": "AI-powered assistants inside Obsidian",
"description": "Integrate OpenAI GPT Assistants functionality",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",

View File

@ -6,7 +6,7 @@ import { App } from 'obsidian';
import Intelligence from '../../main';
import OpenAI from 'openai';
export const OBSIDIAN_INTELLIGENCE_VIEW_TYPE = 'obsidian-intelligence-view';
export const INTELLIGENCE_VIEW_TYPE = 'obsidian-intelligence-view';
@ -55,11 +55,11 @@ export class AppView extends ItemView {
}
getViewType() {
return OBSIDIAN_INTELLIGENCE_VIEW_TYPE;
return INTELLIGENCE_VIEW_TYPE;
}
getDisplayText() {
return 'Obsidian Intelligence';
return 'Intelligence';
}
getIcon(): string {
return 'bot';

View File

@ -1,5 +1,5 @@
import { Notice } from 'obsidian';
export const createNotice = (message: string, timeout = 5000): void => {
new Notice(`Obsidian Intelligence: ${message}`, timeout);
new Notice(`Intelligence: ${message}`, timeout);
};