feat: prepare 2.2.0 with UI and execution fixes
Add dark theme, richer Markdown and readable plugin results. Improve Android input evidence, response integrity and diagnostics. Unify lifecycle, guidance receipts and evidence sources across clients. Keep direct action dispatch without an added AI quota approval layer. Align version metadata at 2.2.0 and bundle Helper 1.2.2. Validation: 3063 backend tests before the version bump; 44 after. Frontend: 317 tests and production build passed.
This commit is contained in:
1 parent
83bcfd54d5
commit
fac4ccb760
146 files changed
+5689
-2033
No files matched your search
+39
-1
@@ -1,7 +1,7 @@
|
||||
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { FinalReview, LlmRequestStatusComponent, ModelRequest, requestHint, reviewStage } from './llm-request-status.component';
|
||||
import { cancellationReason, FinalReview, LlmRequestStatusComponent, ModelRequest, requestHint, requestTermination, reviewStage } from './llm-request-status.component';
|
||||
|
||||
const waiting: ModelRequest = {
|
||||
request_id: 'call-1', attempt_id: 'attempt-1', model: 'gpt-6-luna', role: 'FlashRunner',
|
||||
@@ -118,4 +118,42 @@ describe('模型请求诊断', () => {
|
||||
expect(reviewStage({ ...review, status: 'cancelled' })).toBe('验收已中断');
|
||||
expect(reviewStage({ ...review, status: 'completed' })).toBe('验收完成');
|
||||
});
|
||||
|
||||
it('取消原因有来源才显示,旧记录与未知字段保留未知', () => {
|
||||
expect(cancellationReason('user_stop')).toContain('用户停止');
|
||||
expect(cancellationReason('guidance_replaced')).toContain('新指导替换');
|
||||
expect(cancellationReason('task_paused')).toContain('任务暂停');
|
||||
expect(cancellationReason('task_replaced')).toContain('新任务替换');
|
||||
expect(cancellationReason('superseded')).toContain('新的检查或计划');
|
||||
expect(cancellationReason()).toContain('取消来源未记录');
|
||||
expect(cancellationReason('untrusted new instruction')).toContain('取消来源未记录');
|
||||
expect(requestTermination({ ...waiting, phase: 'cancelled' })).toContain('取消来源未记录');
|
||||
});
|
||||
|
||||
it('区分三层超时、未完成输出与未确认来源的499', () => {
|
||||
expect(requestTermination({ ...waiting, phase: 'failed', timeout_scope: 'request' })).toContain('单次模型请求');
|
||||
expect(requestTermination({ ...waiting, phase: 'failed', timeout_scope: 'transport' })).toContain('连接或读写超时');
|
||||
expect(requestTermination({ ...waiting, phase: 'failed', timeout_scope: 'final_review' })).toContain('最终验收总预算');
|
||||
expect(requestTermination({ ...waiting, phase: 'cancelled', cancel_reason: 'outer_timeout', timeout_scope: 'outer' })).toContain('外层等待时限');
|
||||
expect(requestTermination({ ...waiting, phase: 'failed', http_status: 499 })).toContain('来源尚未确认');
|
||||
expect(requestTermination({ ...waiting, phase: 'failed', category: 'connection' })).toContain('来源需结合服务端记录');
|
||||
expect(requestTermination({ ...waiting, phase: 'failed', response_guard: { reason: 'missing_completion' } })).toContain('本次输出未被采用');
|
||||
expect(requestTermination({ ...waiting, phase: 'completed' })).toBe('');
|
||||
});
|
||||
|
||||
it('将本次尝试、上次重试、链路编号与结束原因一起展示', () => {
|
||||
const fixture = TestBed.createComponent(LlmRequestStatusComponent);
|
||||
fixture.componentRef.setInput('sessionId', 'cancelled'); fixture.detectChanges();
|
||||
TestBed.inject(HttpTestingController).expectOne('/api/sessions/cancelled/request-diagnostics').flush({ requests: [{
|
||||
...waiting, active: false, phase: 'cancelled', cancel_reason: 'guidance_replaced',
|
||||
cancel_phase: 'retry_wait', previous_attempt_id: 'attempt-before', client_request_id: 'client-wire-id',
|
||||
server_request_id: 'server-wire-id', response_id: 'resp-from-server', server_trace_id: 'gateway-trace',
|
||||
traceparent: '00-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bbbbbbbbbbbbbbbb-01', ended_at: Date.now() / 1000
|
||||
}] });
|
||||
fixture.detectChanges();
|
||||
const text = fixture.nativeElement.textContent;
|
||||
for (const value of ['attempt-before', 'client-wire-id', 'server-wire-id', 'resp-from-server', 'gateway-trace', '新指导替换了旧请求', '中断阶段', '等待重试']) expect(text).toContain(value);
|
||||
expect(fixture.nativeElement.querySelector('.request-live')).toBeNull();
|
||||
fixture.destroy();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user