-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- bump to 0.1.1 - Switch thread id and project_dir to workspace state - Add commands to manage new system - Update readme for new way of running prompts - Refactor commands into barrel
- Loading branch information
1 parent
aaab8e8
commit a0ca15f
Showing
9 changed files
with
132 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// barreli boi | ||
import * as vscode from 'vscode' | ||
import { runPrompt } from './runPrompt'; | ||
import { runHotCommand } from './runHotCommand'; | ||
import { deletePrompt, savePrompt } from './manageSavedPrompts'; | ||
import { setProjectDir } from './setProjectDir'; | ||
import { setThreadId } from './setThreadId'; | ||
|
||
type CTX = { secrets: any } | ||
|
||
const commands = (context: CTX) => [ | ||
{ id: 'docker.labs-ai-tools-vscode.run-commands', callback: runHotCommand }, | ||
{ id: 'docker.labs-ai-tools-vscode.save-prompt', callback: savePrompt }, | ||
{ id: 'docker.labs-ai-tools-vscode.delete-prompt', callback: deletePrompt }, | ||
{ id: 'docker.labs-ai-tools-vscode.run-workspace-as-prompt', callback: () => runPrompt(context.secrets, 'local-dir') }, | ||
{ id: 'docker.labs-ai-tools-vscode.run-file-as-prompt', callback: () => runPrompt(context.secrets, 'local-file') }, | ||
{ id: 'docker.labs-ai-tools-vscode.run-prompt', callback: () => runPrompt(context.secrets, 'remote') }, | ||
{ id: 'docker.labs-ai-tools-vscode.project-dir', callback: setProjectDir }, | ||
{ id: 'docker.labs-ai-tools-vscode.thread-id', callback: setThreadId }, | ||
] | ||
|
||
export default (context: CTX) => commands(context).map((comm) => vscode.commands.registerCommand(comm.id, comm.callback)) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { window } from "vscode" | ||
import { ctx } from "../extension"; | ||
|
||
export const setProjectDir = async (overwrite = true) => { | ||
const existingVal = ctx.workspaceState.get<string>('project_dir') | ||
if (!overwrite && existingVal) { | ||
return existingVal | ||
} | ||
const directory = await window.showOpenDialog({ | ||
openLabel: 'Use this project', | ||
canSelectFiles: false, | ||
canSelectFolders: true, | ||
canSelectMany: false | ||
}) | ||
if (!directory) { | ||
window.showErrorMessage('Project directory not set.') | ||
return undefined; | ||
} | ||
const path = directory[0].fsPath | ||
await ctx.workspaceState.update('project_dir', path) | ||
window.showInformationMessage(`Project directory set to ${path}`) | ||
return path; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { window } from "vscode" | ||
import { ctx } from "../extension" | ||
|
||
export const setThreadId = async (overwrite = true) => { | ||
const existingVal = ctx.workspaceState.get<string>('thread_id') | ||
if (!overwrite && existingVal) { | ||
return existingVal | ||
} | ||
const resp = await window.showInputBox({ | ||
title: 'Thread ID', | ||
prompt: 'Enter a simple string to tag the thread volume.' | ||
}) | ||
if (!resp) { | ||
window.showErrorMessage('No thread ID set.') | ||
return undefined; | ||
} | ||
await ctx.workspaceState.update('thread_id', resp) | ||
window.showInformationMessage(`Thread ID set to ${resp}`) | ||
return resp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters