|
@@ -204,6 +204,7 @@ export interface PreviewChatMessage {
|
|
|
turnId?: string // set when message is created via begin/commit
|
|
turnId?: string // set when message is created via begin/commit
|
|
|
recovery?: 'retry' | 'rerecord' | 'restart' // set on error; drives the button matrix
|
|
recovery?: 'retry' | 'rerecord' | 'restart' // set on error; drives the button matrix
|
|
|
audioBlob?: Blob
|
|
audioBlob?: Blob
|
|
|
|
|
+ audioUrl?: string
|
|
|
evaluation?: {
|
|
evaluation?: {
|
|
|
dimensions: {
|
|
dimensions: {
|
|
|
accuracy: 'excellent' | 'good' | 'improve'
|
|
accuracy: 'excellent' | 'good' | 'improve'
|
|
@@ -242,6 +243,8 @@ export interface SessionConfig {
|
|
|
durationMinutes: number
|
|
durationMinutes: number
|
|
|
vocabulary?: string[]
|
|
vocabulary?: string[]
|
|
|
sentences?: string[]
|
|
sentences?: string[]
|
|
|
|
|
+ configId?: string | null
|
|
|
|
|
+ userId?: string | null
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 对话会话信息 (createSession 返回)
|
|
// 对话会话信息 (createSession 返回)
|
|
@@ -257,12 +260,36 @@ export interface GreetingInfo {
|
|
|
aiMessage: string
|
|
aiMessage: string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+export interface HistoricalDialogueMessage {
|
|
|
|
|
+ id: string
|
|
|
|
|
+ round: number
|
|
|
|
|
+ role: 'ai' | 'student'
|
|
|
|
|
+ content: string
|
|
|
|
|
+ audioUrl?: string | null
|
|
|
|
|
+ clientTurnId?: string | null
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 用于启动 chat view 的最小 session 信息(父组件 createSession 后传给 DialogueChatView)
|
|
// 用于启动 chat view 的最小 session 信息(父组件 createSession 后传给 DialogueChatView)
|
|
|
// expiresAt 由后端基于 createSession 时传入的 durationMinutes 计算下发 —— 后端权威,
|
|
// expiresAt 由后端基于 createSession 时传入的 durationMinutes 计算下发 —— 后端权威,
|
|
|
// 关页面/刷新/换设备重进都接续同一个截止时刻,确保倒计时不会因任何原因暂停。
|
|
// 关页面/刷新/换设备重进都接续同一个截止时刻,确保倒计时不会因任何原因暂停。
|
|
|
export interface SessionStartInfo {
|
|
export interface SessionStartInfo {
|
|
|
sessionId: string
|
|
sessionId: string
|
|
|
expiresAt: string | null
|
|
expiresAt: string | null
|
|
|
|
|
+ currentRound?: number
|
|
|
|
|
+ messages?: HistoricalDialogueMessage[]
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export interface LatestSessionInfo extends SessionStartInfo {
|
|
|
|
|
+ status: 'active' | 'completed' | 'abandoned'
|
|
|
|
|
+ totalRounds: number
|
|
|
|
|
+ currentRound: number
|
|
|
|
|
+ createdAt: string | null
|
|
|
|
|
+ completedAt: string | null
|
|
|
|
|
+ messages: HistoricalDialogueMessage[]
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+export interface LatestSessionResponse {
|
|
|
|
|
+ session: LatestSessionInfo | null
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 对话报告
|
|
// 对话报告
|
|
@@ -290,6 +317,7 @@ export interface TaskHint {
|
|
|
// 对话 API 接口
|
|
// 对话 API 接口
|
|
|
export interface DialogueAPI {
|
|
export interface DialogueAPI {
|
|
|
createSession(config: SessionConfig): Promise<SessionInfo>
|
|
createSession(config: SessionConfig): Promise<SessionInfo>
|
|
|
|
|
+ getLatestSession(configId: string, userId: string): Promise<LatestSessionResponse>
|
|
|
completeSession(sessionId: string): Promise<void>
|
|
completeSession(sessionId: string): Promise<void>
|
|
|
/** Throws DOMException('AbortError') on signal abort; throws DialogueApiError on non-OK HTTP. */
|
|
/** Throws DOMException('AbortError') on signal abort; throws DialogueApiError on non-OK HTTP. */
|
|
|
generateGreeting(sessionId: string, turnId: string, signal?: AbortSignal): Promise<GreetingInfo>
|
|
generateGreeting(sessionId: string, turnId: string, signal?: AbortSignal): Promise<GreetingInfo>
|
|
@@ -308,4 +336,4 @@ export interface BadgeAchievement {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 预览对话状态
|
|
// 预览对话状态
|
|
|
-export type PreviewDialogueState = 'ready' | 'chatting' | 'completed'
|
|
|
|
|
|
|
+export type PreviewDialogueState = 'checking-history' | 'ready' | 'chatting' | 'completed'
|