feat: 生图结果行显示「已自动转英文发送」提示(悬停查看英文原文), prompt_en接入
This commit is contained in:
1 parent
45f2f117dd
commit
ac91ac468a
2 files changed
+19
No files matched your search
@@ -7,6 +7,7 @@ const prompt = ref('');
|
||||
const loading = ref(false);
|
||||
const error = ref('');
|
||||
const resultUrl = ref('');
|
||||
const promptEn = ref(''); // 中文提示词自动转英文后的实际发送内容
|
||||
|
||||
// ---------- 自定义提供商(KEY 只存本机浏览器 localStorage) ----------
|
||||
const PROVIDER_KEY = 'it-tools-ai-provider';
|
||||
@@ -107,6 +108,7 @@ async function loadHistory() {
|
||||
function openHist(it: any) {
|
||||
resultUrl.value = it.img_url || '';
|
||||
error.value = '';
|
||||
promptEn.value = '';
|
||||
}
|
||||
|
||||
// 宽高比
|
||||
@@ -265,6 +267,7 @@ async function generate() {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
resultUrl.value = '';
|
||||
promptEn.value = '';
|
||||
try {
|
||||
const r = ratioObj.value;
|
||||
const body: any = {
|
||||
@@ -288,6 +291,7 @@ async function generate() {
|
||||
if (!res.ok || j.code !== 200) throw new Error(j.message || `HTTP ${res.status}`);
|
||||
const dataUrl = j.data.b64 ? b64DataUrl(j.data.b64) : '';
|
||||
resultUrl.value = j.data.img_url || dataUrl || j.data.url;
|
||||
promptEn.value = j.data.prompt_en || ''; // 后端已把中文转英文再发送
|
||||
loadHistory();
|
||||
loadQuota(); // 生成后刷新当日剩余次数
|
||||
}
|
||||
@@ -421,6 +425,7 @@ async function generate() {
|
||||
<div class="gen-img-acts">
|
||||
<a class="gen-dl" :href="dlHref" target="_blank" rel="noopener" download>⬇ 下载图片</a>
|
||||
<a class="gen-dl" :href="resultUrl" target="_blank" rel="noopener">🔗 新窗口打开</a>
|
||||
<span v-if="promptEn" class="gen-tr" :title="promptEn">🌐 已自动转英文发送(悬停查看)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="loading" class="gen-empty">
|
||||
@@ -928,6 +933,19 @@ async function generate() {
|
||||
.gen-img-acts {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.gen-tr {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
cursor: help;
|
||||
margin-left: auto;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 60%;
|
||||
}
|
||||
|
||||
.gen-dl {
|
||||
|
||||
Reference in new issue
Block a user