Skip to content

Commit

Permalink
Add prompt editor
Browse files Browse the repository at this point in the history
  • Loading branch information
joelhulen committed Dec 13, 2024
1 parent fbd2611 commit ef84aad
Show file tree
Hide file tree
Showing 5 changed files with 620 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ui/ManagementPortal/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<li><NuxtLink to="/agents/create" class="sidebar__item">Create New Agent</NuxtLink></li>
<li><NuxtLink to="/agents/public" class="sidebar__item">All Agents</NuxtLink></li>
<li><NuxtLink to="/agents/private" class="sidebar__item">My Agents</NuxtLink></li>
<li><NuxtLink to="/prompts" class="sidebar__item">Agent Prompts</NuxtLink></li>
</ul>
<!-- <div class="sidebar__item">Performance</div> -->

Expand Down
19 changes: 19 additions & 0 deletions src/ui/ManagementPortal/js/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,25 @@ export default {
/*
Prompts
*/
async getPrompts(): Promise<ResourceProviderGetResult<Prompt>[] | null> {
try {
const data = await this.fetch(`/instances/${this.instanceId}/providers/FoundationaLLM.Prompt/prompts?api-version=${this.apiVersion}`);
return data as ResourceProviderGetResult<Prompt>[];
} catch (error) {
return null;
}
},

async getPromptByName(promptName: string): Promise<ResourceProviderGetResult<Prompt> | null> {
// Attempt to retrieve the prompt. If it doesn't exist, return an empty object.
try {
const data = await this.fetch(`/instances/${this.instanceId}/providers/FoundationaLLM.Prompt/prompts/${promptName}?api-version=${this.apiVersion}`);
return data[0];
} catch (error) {
return null;
}
},

async getPrompt(promptId: string): Promise<ResourceProviderGetResult<Prompt> | null> {
// Attempt to retrieve the prompt. If it doesn't exist, return an empty object.
try {
Expand Down
Loading

0 comments on commit ef84aad

Please sign in to comment.