fix: added copyright, fixed styles, removed logs, and used sentence case for ui

This commit is contained in:
AidanTilgner 2024-02-12 11:16:48 -08:00
parent e88b2a9f1d
commit d5a907afe1
4 changed files with 8 additions and 11 deletions

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) [year] [fullname]
Copyright (c) 2024 Aidan Tilgner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

14
main.ts
View file

@ -44,8 +44,6 @@ The goal is to provide the best completion for the given selection, based on the
export default class Autogen extends Plugin {
settings: AutogenSettings;
typingTimeout: NodeJS.Timeout | null = null;
typingDelay = 2000;
openaiClient: OpenAI | null = null;
async onload() {
@ -196,7 +194,7 @@ class AutogenSuggest extends EditorSuggest<Suggestion> {
): Suggestion[] | Promise<Suggestion[]> {
return [
{
label: "Get Suggestions",
label: "Get suggestions",
id: "getSuggestions",
},
];
@ -262,7 +260,7 @@ class AutogenModal extends Modal {
contentEl.createEl("br");
const buttonContainer = createEl("div");
buttonContainer.addClass("modal-button-container");
buttonContainer.addClass("autogen-modal-button-container");
const confirmButton = createEl("button", { text: "Confirm" });
const cancelButton = createEl("button", { text: "Cancel" });
@ -320,7 +318,7 @@ class AutogenSettingTab extends PluginSettingTab {
apiKeyDesc.appendChild(document.createTextNode(")")); // To add the closing parenthesis
new Setting(containerEl)
.setName("OpenAI API Key")
.setName("OpenAI API key")
.setDesc(apiKeyDesc)
.addText((text) =>
text
@ -370,7 +368,7 @@ class AutogenSettingTab extends PluginSettingTab {
});
new Setting(containerEl)
.setName("Trigger Regex")
.setName("Trigger regex")
.setDesc("The regex pattern to trigger the autogen")
.addText((text) =>
text
@ -383,7 +381,7 @@ class AutogenSettingTab extends PluginSettingTab {
);
new Setting(containerEl)
.setName("Window Size")
.setName("Window size")
.setDesc(
"The max number of characters, not including the prompt, to be sent for the generation. This affects token usage and performance."
)
@ -398,7 +396,7 @@ class AutogenSettingTab extends PluginSettingTab {
);
new Setting(containerEl)
.setName("System Prompt")
.setName("System prompt")
.setDesc("The prompt to send to the OpenAI API")
.addTextArea((text) => {
text.setPlaceholder("Enter the system prompt")

View file

@ -6,7 +6,7 @@ available in the app when your plugin is enabled.
If your plugin does not need CSS, delete this file.
*/
.modal-button-container {
.autogen-modal-button-container {
display: flex;
justify-content: flex-end;
align-items: center;

View file

@ -2,7 +2,6 @@ import OpenAI from "openai";
import { ChatCompletionCreateParamsBase } from "openai/resources/chat/completions";
export const getClient = (apiKey: string) => {
console.log("Dangerously allowing browser");
return new OpenAI({
apiKey,
dangerouslyAllowBrowser: true,