allow user to use chat role directly, no need to add to workspace

This commit is contained in:
RockYang
2024-07-16 18:28:08 +08:00
parent 024f00b73c
commit 82fe9c3596
7 changed files with 51 additions and 56 deletions

View File

@@ -105,7 +105,7 @@ checkSession().then((user) => {
loginUser.value = user
isLogin.value = true
// 加载角色列表
httpGet(`/api/role/list?user_id=${user.id}`).then((res) => {
httpGet(`/api/role/list`).then((res) => {
if (res.data) {
const items = res.data
for (let i = 0; i < items.length; i++) {

View File

@@ -109,7 +109,7 @@ onMounted(() => {
})
const fetchApps = () => {
httpGet("/api/role/list?all=true").then((res) => {
httpGet("/api/role/list").then((res) => {
const items = res.data
// 处理 hello message
for (let i = 0; i < items.length; i++) {

View File

@@ -407,8 +407,16 @@ const connect = () => {
_socket.addEventListener('message', event => {
if (event.data instanceof Blob) {
fetchRunningJobs()
fetchFinishJobs(1)
const reader = new FileReader();
reader.readAsText(event.data, "UTF-8")
reader.onload = () => {
const message = String(reader.result)
if (message === "FINISH" || message === "FAIL") {
page.value = 1
fetchFinishJobs(1)
}
fetchRunningJobs()
}
}
});
@@ -456,7 +464,7 @@ const fetchFinishJobs = (page) => {
httpGet(`/api/mj/jobs?finish=1&page=${page}&page_size=${pageSize.value}`).then(res => {
const jobs = res.data
for (let i = 0; i < jobs.length; i++) {
if (jobs[i].progress === -1) {
if (jobs[i].progress === 101) {
showNotify({
message: `任务ID${jobs[i]['task_id']} 原因:${jobs[i]['err_msg']}`,
type: 'danger',
@@ -479,7 +487,7 @@ const fetchFinishJobs = (page) => {
}
}
if (jobs[i].type === 'image' || jobs[i].type === 'variation') {
if ((jobs[i].type === 'image' || jobs[i].type === 'variation') && jobs[i].progress === 100){
jobs[i]['can_opt'] = true
}
}