Spaces:
Running
Running
Update static/js/project.js
Browse files- static/js/project.js +44 -2
static/js/project.js
CHANGED
@@ -73,9 +73,51 @@ function removeIntent(name) {
|
|
73 |
}
|
74 |
|
75 |
function saveProject() {
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
79 |
function publishProject() {
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
|
|
|
73 |
}
|
74 |
|
75 |
function saveProject() {
|
76 |
+
const project = document.getElementById('project-select').value;
|
77 |
+
if (!project) return;
|
78 |
+
|
79 |
+
apiGet(`/project/${project}/latest`)
|
80 |
+
.then(data => {
|
81 |
+
const newData = {
|
82 |
+
intents: data.intents,
|
83 |
+
llm: data.llm
|
84 |
+
};
|
85 |
+
apiPost('/project/update', {
|
86 |
+
project_name: project,
|
87 |
+
client_last_updated: data.last_updated,
|
88 |
+
new_data: newData
|
89 |
+
})
|
90 |
+
.then(resp => {
|
91 |
+
showResult('project-result', resp);
|
92 |
+
loadProjectDetails();
|
93 |
+
})
|
94 |
+
.catch(err => {
|
95 |
+
console.error(err);
|
96 |
+
alert('Failed to save project.');
|
97 |
+
});
|
98 |
+
})
|
99 |
+
.catch(err => console.error(err));
|
100 |
}
|
101 |
|
102 |
function publishProject() {
|
103 |
+
const project = document.getElementById('project-select').value;
|
104 |
+
if (!project) return;
|
105 |
+
|
106 |
+
apiGet(`/project/${project}/latest`)
|
107 |
+
.then(data => {
|
108 |
+
apiPost('/project/publish', {
|
109 |
+
project_name: project,
|
110 |
+
client_last_updated: data.last_updated
|
111 |
+
})
|
112 |
+
.then(resp => {
|
113 |
+
showResult('project-result', resp);
|
114 |
+
loadProjectDetails();
|
115 |
+
})
|
116 |
+
.catch(err => {
|
117 |
+
console.error(err);
|
118 |
+
alert('Failed to publish project.');
|
119 |
+
});
|
120 |
+
})
|
121 |
+
.catch(err => console.error(err));
|
122 |
}
|
123 |
+
|