MCPcopy
hub / github.com/wandb/openui / voteRequest

Function voteRequest

frontend/src/api/openui.ts:38–60  ·  view source on GitHub ↗
(
	vote: boolean,
	item: ItemWrapper,
	versionIdx: number
)

Source from the content-addressed store, hash-verified

36}
37
38export async function voteRequest(
39 vote: boolean,
40 item: ItemWrapper,
41 versionIdx: number
42) {
43 const r = await fetch(`${API_HOST}/vote`, {
44 method: 'POST',
45 headers: {
46 'Content-Type': 'application/json'
47 },
48 body: JSON.stringify({
49 prompt: item.prompt(versionIdx),
50 html: item.pureHTML(versionIdx),
51 name: item.name,
52 emoji: item.emoji,
53 vote
54 })
55 })
56 if (r.status !== 201) {
57 const body = (await r.json()) as ErrorBody
58 throw new Error(body.error.message)
59 }
60}
61
62export async function getShare(id: string): Promise<HistoryItem> {
63 const r = await fetch(`${API_HOST}/share/${id}`)

Callers 1

HTMLAnnotatorFunction · 0.90

Calls 2

promptMethod · 0.80
pureHTMLMethod · 0.80

Tested by

no test coverage detected