Compare commits
2 Commits
b17aec4a1a
...
eb8cab3f5a
| Author | SHA1 | Date |
|---|---|---|
|
|
eb8cab3f5a | |
|
|
fa99a4fb9b |
|
|
@ -580,12 +580,18 @@ export default {
|
||||||
el.scrollTop = el.scrollHeight
|
el.scrollTop = el.scrollHeight
|
||||||
},
|
},
|
||||||
|
|
||||||
|
taskRowResultTrim(row) {
|
||||||
|
return String(row?.result ?? '').trim()
|
||||||
|
},
|
||||||
|
|
||||||
taskStatusText(row) {
|
taskStatusText(row) {
|
||||||
// 与后端约定:0 执行中,2 失败,1+http(s) 成功,1 且非 http 为生成失败
|
|
||||||
if (row.status === 2) return '已失败/已取消'
|
if (row.status === 2) return '已失败/已取消'
|
||||||
if (row.status === 0) return '执行中'
|
if (row.status === 0) return '执行中'
|
||||||
if (row.status === 1) {
|
if (row.status === 1) {
|
||||||
if (row.result && this.isHttpOrHttpsUrl(row.result)) return '已完成'
|
const r = this.taskRowResultTrim(row)
|
||||||
|
if (!r) return '失败'
|
||||||
|
if (this.isHttpOrHttpsUrl(r)) return '已完成'
|
||||||
|
if (/^cgt/i.test(r)) return '任务执行中'
|
||||||
return '任务生成失败'
|
return '任务生成失败'
|
||||||
}
|
}
|
||||||
return '执行中'
|
return '执行中'
|
||||||
|
|
@ -593,12 +599,19 @@ export default {
|
||||||
|
|
||||||
/** 是否展示完整「结果区」(视频 / 链接);其余状态仅紧凑展示在用户行右侧 */
|
/** 是否展示完整「结果区」(视频 / 链接);其余状态仅紧凑展示在用户行右侧 */
|
||||||
isChatRowSuccessWithMedia(row) {
|
isChatRowSuccessWithMedia(row) {
|
||||||
return row.status === 1 && row.result && this.isHttpOrHttpsUrl(row.result)
|
const r = this.taskRowResultTrim(row)
|
||||||
|
return row.status === 1 && !!r && this.isHttpOrHttpsUrl(r)
|
||||||
},
|
},
|
||||||
|
|
||||||
chatRowInlineStatusClass(row) {
|
chatRowInlineStatusClass(row) {
|
||||||
if (row.status === 2) return 'vg-chat-inline-status--failed'
|
if (row.status === 2) return 'vg-chat-inline-status--failed'
|
||||||
if (row.status === 1 && !this.isHttpOrHttpsUrl(row.result)) return 'vg-chat-inline-status--failed'
|
if (row.status === 1) {
|
||||||
|
const r = this.taskRowResultTrim(row)
|
||||||
|
if (!r) return 'vg-chat-inline-status--failed'
|
||||||
|
if (/^cgt/i.test(r)) return 'vg-chat-inline-status--running'
|
||||||
|
if (this.isHttpOrHttpsUrl(r)) return 'vg-chat-inline-status--running'
|
||||||
|
return 'vg-chat-inline-status--failed'
|
||||||
|
}
|
||||||
return 'vg-chat-inline-status--running'
|
return 'vg-chat-inline-status--running'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,14 @@ public class TencentCosUtil {
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = file.getInputStream();
|
InputStream inputStream = file.getInputStream();
|
||||||
ObjectMetadata objectMetadata = new ObjectMetadata();
|
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||||
|
// 必须设置长度,否则底层 OkHttp 会告警「No content length specified…」并整段缓冲到内存,易 OOM
|
||||||
|
long contentLength = file.getSize();
|
||||||
|
if (contentLength >= 0) {
|
||||||
|
objectMetadata.setContentLength(contentLength);
|
||||||
|
}
|
||||||
|
if (file.getContentType() != null && !file.getContentType().isEmpty()) {
|
||||||
|
objectMetadata.setContentType(file.getContentType());
|
||||||
|
}
|
||||||
PutObjectRequest putObjectRequest = new PutObjectRequest(
|
PutObjectRequest putObjectRequest = new PutObjectRequest(
|
||||||
bucketName,
|
bucketName,
|
||||||
key,
|
key,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue