-
Notifications
You must be signed in to change notification settings - Fork 0
/
taskpane.html
215 lines (201 loc) · 7.59 KB
/
taskpane.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. -->
<!doctype html>
<html>
<head>
<!-- Office JavaScript API -->
<script
type="text/javascript"
src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"
></script>
<script
type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"
></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.14.0/jquery-ui.js"></script>
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/[email protected]/build/global/luxon.min.js"
></script>
<link
href="https://unpkg.com/[email protected]/dist/css/tabulator.min.css"
rel="stylesheet"
/>
<script
type="text/javascript"
src="https://unpkg.com/[email protected]/dist/js/tabulator.min.js"
></script>
<script
type="text/javascript"
src="https://unpkg.com/[email protected]/dist/js/jquery_wrapper.js"
></script>
<script defer type="module" src="src/vertex_ai.js"></script>
<script defer type="module" src="src/excel/addin.js"></script>
<link rel="stylesheet" href="taskpane.css" />
<title>Velvet</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style></style>
</head>
<body>
<div class="container">
<h1 class="title"><a href="https://github.com/abhinavrau/velvet-excel-addin">Velvet</a></h1>
<section class="step">
<h2 class="step-title">Authentication</h2>
<p>
<label for="access-token">Access Token:</label>
<input type="text" id="access-token" placeholder="Paste Access Token" size="100" />
</p>
</section>
<ul class="tabs">
<li class="tab active" data-target="search-tab">Search Eval</li>
<li class="tab" data-target="qa-tab">Synthetic Q&A</li>
<li class="tab" data-target="summarization-tab">Summarization</li>
</ul>
<div class="tab-content active" id="search-tab">
<section class="step">
<h2 class="step-title">Agent Builder Search Eval</h2>
<h3>How to use </h3>
<p>
1. Click the button below to create required tables in the current sheet.
</p>
<p><button id="createSearchTables">Create Search Tables</button></p>
<p>
2. Use the "Synthetic Q&A" Tab to generate Questions and Answers
<b>OR</b>
If you have your own test cases copy into the test case table.
</p>
<p>
3. Fill in Config Parameters for your GCP environment in the Config Table.
Adjust the <b>Premable</b> and other settings for your use case.
</p>
<p><b>
Note:</b> Tests will stop when it sees an empty ID value.
</p>
<button id="executeSearchTests">Run Tests</button>
<button id="cancelSearchTests" style="visibility: hidden; background: red">
Cancel Tests
</button>
</section>
</div>
<div class="tab-content" id="qa-tab">
<section class="step">
<h2 class="step-title">Synthetic Q&A Generation</h2>
<h3>How to use </h3>
<p>
1. Click the button below to create required tables in the current sheet.</p>
</p>
<p><button id="createGenQATables">Create Q&A Tables</button></p>
<p>
2. Fill in "FileUri" column with GCS doc link. <a href="https://firebase.google.com/docs/vertex-ai/input-file-requirements"> Valid file types.</a>
</p>
<p>
3. Fill in Config Parameters for your GCP environment in the Config Table.
Adjust the <b>Prompt</b> and <b>Q&A Quality Prompt</b>
for your use case.
</p>
<p><b>
Note:</b> Generation will stop when it sees an empty ID value.
</p>
<button id="generateQAData">Generate Q&A</button>
<button id="cancelGenerateQAData" style="visibility: hidden; background: red">
Cancel Q&A Generation
</button>
</section>
</div>
<div class="tab-content" id="summarization-tab">
<section class="step">
<h2 class="step-title">Summarization Eval</h2>
<h3>How to use </h3>
<p>
1. Click the button below to create required tables in the current sheet.</p>
</p>
<p>
<button id="createSummarizationTables">Create Summarization Tables</button>
</p>
<p>
2. Fill in "Context" column with Text to summarize.
</p>
<p>
3. Fill in Config Parameters for your GCP environment in the Config Table.
Adjust the <b>Prompt</b> and <b>Summarization Quality Prompt</b>
for your use case.
</p>
<p><b>
Note:</b> Generation will stop when it sees an empty ID value.
</p>
<button id="genSummarizationData">Generate Summaries</button>
<button id="cancelSummarizationData" style="visibility: hidden; background: red">
Cancel Summary Generation
</button>
</section>
</div>
<section class="status">
<h2 class="status-title">Status</h2>
<div class="status"></div>
</section>
<section class="logs">
<button id="toggleLogs">Show/Hide Logs</button>
<div class="log-container">
<div id="log-pane" style="display: none"></div>
</div>
</section>
</div>
<script type="text/javascript">
// Create Tabulator table
$("#log-pane").tabulator({
layout: "fitDataStretch", // Adjust column widths to fit content
layoutColumnsOnNewData: true,
columns: [
{
title: "Time",
field: "time",
sorter: "time",
sorterParams: { format: "HH:mm:ss" },
minWidth: 80,
},
{
title: "Level",
field: "level",
headerFilter: "list",
headerFilterParams: {
values: ["INFO", "ERROR"],
},
headerSort: false,
minWidth: 80,
},
{
title: "Message",
headerFilter: true,
headerSort: false,
field: "message",
formatter: "textarea",
variableHeight: true,
},
],
initialSort: [
{ column: "time", dir: "desc" }, // Initial sort by time descending
],
});
const toggleLogsButton = document.getElementById("toggleLogs");
const logPane = document.getElementById("log-pane");
toggleLogsButton.addEventListener("click", () => {
if (logPane.style.display === "none") {
logPane.style.display = "block"; // Or 'inline' depending on your layout
} else {
logPane.style.display = "none";
}
});
const tabs = document.querySelectorAll(".tab");
const tabContents = document.querySelectorAll(".tab-content");
tabs.forEach((tab) => {
tab.addEventListener("click", () => {
// Remove active class from all tabs and content
tabs.forEach((t) => t.classList.remove("active"));
tabContents.forEach((tc) => tc.classList.remove("active"));
// Add active class to clicked tab and corresponding content
tab.classList.add("active");
document.getElementById(tab.dataset.target).classList.add("active");
});
});
</script>
</body>
</html>