|
174 | 174 | return el; |
175 | 175 | } |
176 | 176 |
|
| 177 | + // Success inline block (green tip) |
| 178 | + function addInlineSuccess(text){ |
| 179 | + const el = document.createElement('div'); |
| 180 | + el.className = 'success-inline'; |
| 181 | + el.textContent = String(text || '成功'); |
| 182 | + messageTimeline.appendChild(el); |
| 183 | + scrollLatestIntoView(); |
| 184 | + return el; |
| 185 | + } |
| 186 | + |
177 | 187 | // Error inline block under latest message |
178 | 188 | function addInlineError(text, raw){ |
179 | 189 | const el = document.createElement('div'); |
|
701 | 711 | // 发起新请求前自动清空历史记录 |
702 | 712 | clearResults(); |
703 | 713 |
|
704 | | - const scenario = document.querySelector('.seg-btn.active')?.dataset.scenario || 'openai_tools'; |
| 714 | + const scenario = testTypeWrap.querySelector('.seg-btn.active')?.dataset.scenario || 'openai_tools'; |
705 | 715 | const endpoint = buildEndpoint(apiUrl); |
706 | 716 | const geminiEndpoint = buildGeminiEndpoint(apiUrl, model, apiKey); |
707 | 717 | const anthropicEndpoint = buildAnthropicEndpoint(apiUrl); |
|
1028 | 1038 | // 未触发搜索工具调用的提示放在响应下面 |
1029 | 1039 | if(!hasWebSearchCall){ |
1030 | 1040 | addInlineInfo('未触发搜索工具调用:模型可能未理解指令,或 API 异常。'); |
| 1041 | + } else { |
| 1042 | + addInlineSuccess('模型成功进行了搜索工具调用,但回答中仍可能含有事实性错误'); |
1031 | 1043 | } |
1032 | 1044 | } |
1033 | 1045 | else if(scenario === 'gemini_search'){ |
|
1049 | 1061 | const hasGroundingMetadata = cand && cand.groundingMetadata; |
1050 | 1062 | if(!hasGroundingMetadata){ |
1051 | 1063 | addInlineInfo('未触发搜索工具调用:模型可能未理解指令,或 API 异常。'); |
| 1064 | + } else { |
| 1065 | + addInlineSuccess('模型成功进行了搜索工具调用,但回答中仍可能含有事实性错误'); |
1052 | 1066 | } |
1053 | 1067 | } |
1054 | 1068 | else if(scenario === 'gemini_url_context'){ |
|
1070 | 1084 | const hasGroundingMetadata = cand && cand.groundingMetadata; |
1071 | 1085 | if(!hasGroundingMetadata){ |
1072 | 1086 | addInlineInfo('未触发 URL 上下文工具调用:模型可能未理解指令,或 API 异常。'); |
| 1087 | + } else { |
| 1088 | + addInlineSuccess('模型成功进行了搜索工具调用,但回答中仍可能含有事实性错误'); |
1073 | 1089 | } |
1074 | 1090 | } |
1075 | 1091 |
|
|
0 commit comments