feat(coding): keep one ongoing conversation per delivered agent
This commit is contained in:
1 parent
e54f3d234d
commit
7aa81da616
23 files changed
+1205
-160
No files matched your search
@@ -9,6 +9,7 @@ import type {
|
||||
TeacherSend,
|
||||
TeacherTopic,
|
||||
TeacherTopicList,
|
||||
TeacherConversationView,
|
||||
} from '../../shared/coding-teacher';
|
||||
export function teacherTopicsPath(projectId: string) {
|
||||
return projectId === 'preview'
|
||||
@@ -20,6 +21,15 @@ export function legacyTopicBase(base: string, legacyFriend: boolean) {
|
||||
return legacyFriend ? base.replace(/agent-topics$/, 'friend-topics') : base;
|
||||
}
|
||||
export const teacherApi = {
|
||||
legacyHistory: (projectId: string) => hostApiFetch<TeacherTopicList>(`/api/coding/projects/${encodeURIComponent(projectId)}/agent-history`),
|
||||
legacyRead: (projectId: string, item: TeacherTopicList['items'][number]) => hostApiFetch<TeacherTopic>(
|
||||
`/api/coding/projects/${encodeURIComponent(projectId)}/agent-history/${encodeURIComponent(item.id)}?source=${encodeURIComponent(item.legacySourceId ?? 'project')}&friend=${item.legacyRole === 'friend'}`),
|
||||
seenConversation: (agentId: string, requestId: string) => hostApiFetch<TeacherTopic>(
|
||||
'/api/coding/agent-conversations/' + encodeURIComponent(agentId) + '/seen', { method: 'POST', body: JSON.stringify({ requestId }) }),
|
||||
conversation: (agentId: string, before?: string) => hostApiFetch<TeacherConversationView>(
|
||||
'/api/coding/agent-conversations/' + encodeURIComponent(agentId) + (before ? '?before=' + encodeURIComponent(before) : '')),
|
||||
sendConversation: (agentId: string, input: TeacherSend) => hostApiFetch<TeacherTopic>(
|
||||
'/api/coding/agent-conversations/' + encodeURIComponent(agentId) + '/messages', { method: 'POST', body: JSON.stringify(input) }),
|
||||
catalog: () => hostApiFetch<TeacherCatalog>('/api/coding/teacher/teachers'),
|
||||
checkIn: (projectId: string, input: TeacherCheckInInput) =>
|
||||
hostApiFetch<TeacherCheckInResult>(`/api/coding/projects/${encodeURIComponent(projectId)}/teacher-check-in`, {
|
||||
|
||||
Reference in new issue
Block a user