mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Add cron-based scheduling with prompt templates integration (#164)
This commit is contained in:
1 parent
cbd0ee2958
commit
1e863c5fc5
63 files changed
+7797
-64
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { fetchWrapper, fetchWrapperVoid } from './fetchWrapper'
|
||||
import { API_BASE_URL } from '@/config'
|
||||
import type {
|
||||
PromptTemplate,
|
||||
CreatePromptTemplateRequest,
|
||||
UpdatePromptTemplateRequest,
|
||||
} from '@opencode-manager/shared/types'
|
||||
|
||||
export async function listPromptTemplates(): Promise<{ templates: PromptTemplate[] }> {
|
||||
return fetchWrapper(`${API_BASE_URL}/api/prompt-templates`)
|
||||
}
|
||||
|
||||
export async function createPromptTemplate(data: CreatePromptTemplateRequest): Promise<{ template: PromptTemplate }> {
|
||||
return fetchWrapper(`${API_BASE_URL}/api/prompt-templates`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
}
|
||||
|
||||
export async function updatePromptTemplate(id: number, data: UpdatePromptTemplateRequest): Promise<{ template: PromptTemplate }> {
|
||||
return fetchWrapper(`${API_BASE_URL}/api/prompt-templates/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
})
|
||||
}
|
||||
|
||||
export async function deletePromptTemplate(id: number): Promise<void> {
|
||||
return fetchWrapperVoid(`${API_BASE_URL}/api/prompt-templates/${id}`, {
|
||||
method: 'DELETE',
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user