-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfront_end_index.html
More file actions
209 lines (186 loc) · 7.28 KB
/
front_end_index.html
File metadata and controls
209 lines (186 loc) · 7.28 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fluent Web Frontend</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
color: #333;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
h1 {
text-align: center;
color: #4a90e2;
}
form {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 600px;
width: 100%;
}
div {
margin-bottom: 15px;
}
label {
font-weight: bold;
display: block;
margin-bottom: 5px;
}
input[type="text"], textarea, select {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type="checkbox"] {
margin-right: 5px;
}
button {
background-color: #4a90e2;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #357ab8;
}
#output {
margin-top: 20px;
padding: 10px;
background-color: #e9f7ef;
border: 1px solid #d4edda;
border-radius: 4px;
white-space: pre-wrap;
overflow-x: auto;
}
</style>
<script>
// Global error handler to suppress Google Analytics errors
window.addEventListener('error', function(event) {
if (event.message && event.message.includes('google-analytics.com')) {
event.preventDefault();
console.warn('Google Analytics error suppressed:', event.message);
}
});
function executeCommand() {
const formData = new FormData(document.getElementById('fluent-form'));
const commandData = {
engine: formData.get('engine'),
request: formData.get('request'),
config: formData.get('config'),
override: formData.getAll('override').join(' '),
additionalContextFile: formData.get('additionalContextFile'),
upsert: formData.get('upsert') === 'on',
input: formData.get('input'),
metadata: formData.get('metadata'),
uploadImageFile: formData.get('uploadImageFile'),
downloadMedia: formData.get('downloadMedia'),
parseCode: formData.get('parseCode') === 'on',
executeOutput: formData.get('executeOutput') === 'on',
markdown: formData.get('markdown') === 'on',
generateCypher: formData.get('generateCypher'),
pipelineFile: formData.get('pipelineFile'),
pipelineInput: formData.get('pipelineInput'),
jsonOutput: formData.get('jsonOutput') === 'on',
runId: formData.get('runId'),
forceFresh: formData.get('forceFresh') === 'on',
};
fetch('/execute', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(commandData)
})
.then(response => response.json())
.then(data => {
const outputElement = document.getElementById('output');
if (data.output) {
try {
const parsedJson = JSON.parse(data.output);
outputElement.innerText = JSON.stringify(parsedJson, null, 2);
} catch (e) {
outputElement.innerText = data.output;
}
} else if (data.error) {
outputElement.innerText = "Error: " + data.error;
}
});
}
function addOverride() {
const overrideInput = document.getElementById('override');
const overrideValue = overrideInput.value;
if (overrideValue) {
const overridesDiv = document.getElementById('overrides');
const newOverride = document.createElement('input');
newOverride.type = 'hidden';
newOverride.name = 'override';
newOverride.value = overrideValue;
overridesDiv.appendChild(newOverride);
overrideInput.value = '';
}
}
</script>
</head>
<body>
<form id="fluent-form">
<h1>Fluent Web Frontend</h1>
<div>
<label for="engine">Engine:</label>
<select id="engine" name="engine">
<option value="openai">openai</option>
<option value="openai-mini">openai-mini</option>
</select>
</div>
<input type="text" id="request" name="request" placeholder="Enter Fluent request">
<div>
<label for="config">Config (JSON):</label>
<textarea id="config" name="config" placeholder="Paste JSON config"></textarea>
</div>
<div>
<label for="override">Override (KEY=VALUE):</label>
<input type="text" id="override" name="override">
<button type="button" onclick="addOverride()">Add Override</button>
<div id="overrides"></div>
</div>
<input type="checkbox" id="upsert" name="upsert">
<label for="upsert">Upsert</label>
<input type="text" id="input" name="input" placeholder="Input File/Directory (for upsert)">
<input type="text" id="metadata" name="metadata" placeholder="Metadata (for upsert)">
<input type="file" id="uploadImageFile" name="uploadImageFile">
<input type="text" id="downloadMedia" name="downloadMedia" placeholder="Download Media Directory">
<input type="checkbox" id="parseCode" name="parseCode">
<label for="parseCode">Parse Code</label>
<input type="checkbox" id="executeOutput" name="executeOutput">
<label for="executeOutput">Execute Output</label>
<input type="checkbox" id="markdown" name="markdown">
<label for="markdown">Markdown</label>
<input type="text" id="generateCypher" name="generateCypher" placeholder="Cypher Query">
<h2>Pipeline</h2>
<div>
<label for="pipelineFile">Pipeline File (YAML):</label>
<textarea id="pipelineFile" name="pipelineFile" placeholder="Paste YAML pipeline"></textarea>
</div>
<input type="text" id="pipelineInput" name="pipelineInput" placeholder="Pipeline Input">
<input type="checkbox" id="jsonOutput" name="jsonOutput">
<label for="jsonOutput">JSON Output</label>
<input type="text" id="runId" name="runId" placeholder="Run ID">
<input type="checkbox" id="forceFresh" name="forceFresh">
<label for="forceFresh">Force Fresh</label>
<button type="button" onclick="executeCommand()">Execute</button>
</form>
<div id="output"></div>
</body>
</html>