@codeguide/core 0.0.33 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/services/usage/usage-service.test.ts +53 -29
- package/codeguide.ts +3 -0
- package/dist/codeguide.d.ts +2 -1
- package/dist/codeguide.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/services/chat/chat-service.d.ts +44 -0
- package/dist/services/chat/chat-service.js +85 -0
- package/dist/services/chat/chat-types.d.ts +88 -0
- package/dist/services/chat/chat-types.js +5 -0
- package/dist/services/chat/index.d.ts +2 -0
- package/dist/services/chat/index.js +20 -0
- package/dist/services/generation/generation-service.d.ts +7 -1
- package/dist/services/generation/generation-service.js +18 -0
- package/dist/services/generation/generation-types.d.ts +95 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +7 -1
- package/dist/services/projects/project-service.d.ts +3 -1
- package/dist/services/projects/project-service.js +13 -1
- package/dist/services/projects/project-types.d.ts +24 -1
- package/dist/services/streaming/index.d.ts +2 -0
- package/dist/services/streaming/index.js +20 -0
- package/dist/services/streaming/streaming-service.d.ts +30 -0
- package/dist/services/streaming/streaming-service.js +107 -0
- package/dist/services/streaming/streaming-types.d.ts +14 -0
- package/dist/services/streaming/streaming-types.js +2 -0
- package/dist/services/tasks/task-service.d.ts +3 -1
- package/dist/services/tasks/task-service.js +8 -0
- package/dist/services/tasks/task-types.d.ts +15 -0
- package/dist/services/usage/usage-service.d.ts +35 -1
- package/dist/services/usage/usage-service.js +68 -0
- package/dist/services/usage/usage-types.d.ts +108 -33
- package/index.ts +3 -0
- package/package.json +1 -1
- package/services/chat/chat-service.ts +110 -0
- package/services/chat/chat-types.ts +145 -0
- package/services/chat/index.ts +2 -0
- package/services/generation/generation-service.ts +40 -0
- package/services/generation/generation-types.ts +110 -0
- package/services/index.ts +4 -0
- package/services/projects/README.md +54 -0
- package/services/projects/project-service.ts +20 -1
- package/services/projects/project-types.ts +27 -1
- package/services/streaming/index.ts +2 -0
- package/services/streaming/streaming-service.ts +123 -0
- package/services/streaming/streaming-types.ts +15 -0
- package/services/tasks/task-service.ts +30 -2
- package/services/tasks/task-types.ts +19 -1
- package/services/usage/usage-service.ts +81 -0
- package/services/usage/usage-types.ts +116 -36
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { BaseService } from '../base/base-service'
|
|
2
|
+
import {
|
|
3
|
+
GetDocumentTypesRequest,
|
|
4
|
+
GetDocumentTypesResponse,
|
|
5
|
+
GetChatsByDocumentTypeRequest,
|
|
6
|
+
GetChatsByDocumentTypeResponse,
|
|
7
|
+
GetChatHistoryRequest,
|
|
8
|
+
GetChatHistoryResponse,
|
|
9
|
+
ListDocumentChatsRequest,
|
|
10
|
+
ListDocumentChatsResponse,
|
|
11
|
+
GetChatByDocumentIdRequest,
|
|
12
|
+
GetChatByDocumentIdResponse,
|
|
13
|
+
} from './chat-types'
|
|
14
|
+
|
|
15
|
+
export class ChatService extends BaseService {
|
|
16
|
+
/**
|
|
17
|
+
* 1. GET /chat/document/types/{project_id}
|
|
18
|
+
* Get document types for UI grouping
|
|
19
|
+
*
|
|
20
|
+
* @param request - Project ID to get document types for
|
|
21
|
+
* @returns Document types available for the project
|
|
22
|
+
*/
|
|
23
|
+
async getDocumentTypes(request: GetDocumentTypesRequest): Promise<GetDocumentTypesResponse> {
|
|
24
|
+
return this.get<GetDocumentTypesResponse>(`/chat/document/types/${request.project_id}`)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 2. GET /chat/document/by-type/{project_id}/{document_type}
|
|
29
|
+
* List all chats for a specific document type (PRIMARY endpoint for UI)
|
|
30
|
+
*
|
|
31
|
+
* @param request - Filter parameters for document type chats
|
|
32
|
+
* @returns Paginated list of document chats for the specified type
|
|
33
|
+
*/
|
|
34
|
+
async getChatsByDocumentType(
|
|
35
|
+
request: GetChatsByDocumentTypeRequest
|
|
36
|
+
): Promise<GetChatsByDocumentTypeResponse> {
|
|
37
|
+
const { project_id, document_type, chat_status = 'active', limit = 50, offset = 0 } = request
|
|
38
|
+
|
|
39
|
+
// Build query parameters
|
|
40
|
+
const params = new URLSearchParams()
|
|
41
|
+
if (chat_status) params.append('chat_status', chat_status)
|
|
42
|
+
if (limit !== undefined) params.append('limit', limit.toString())
|
|
43
|
+
if (offset !== undefined) params.append('offset', offset.toString())
|
|
44
|
+
|
|
45
|
+
const queryString = params.toString()
|
|
46
|
+
const url = `/chat/document/by-type/${project_id}/${document_type}${queryString ? `?${queryString}` : ''}`
|
|
47
|
+
|
|
48
|
+
return this.get<GetChatsByDocumentTypeResponse>(url)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 3. GET /chat/document/history/{conversation_id}
|
|
53
|
+
* Get full chat history with messages
|
|
54
|
+
*
|
|
55
|
+
* @param request - Conversation ID to get history for
|
|
56
|
+
* @returns Conversation details with all messages
|
|
57
|
+
*/
|
|
58
|
+
async getChatHistory(request: GetChatHistoryRequest): Promise<GetChatHistoryResponse> {
|
|
59
|
+
return this.get<GetChatHistoryResponse>(`/chat/document/history/${request.conversation_id}`)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 4. GET /chat/document/list
|
|
64
|
+
* List all chats for current user (with optional filters)
|
|
65
|
+
*
|
|
66
|
+
* @param request - Filter parameters for listing chats
|
|
67
|
+
* @returns Paginated list of all document chats for the user
|
|
68
|
+
*/
|
|
69
|
+
async listDocumentChats(
|
|
70
|
+
request: ListDocumentChatsRequest = {}
|
|
71
|
+
): Promise<ListDocumentChatsResponse> {
|
|
72
|
+
const {
|
|
73
|
+
project_id,
|
|
74
|
+
document_type,
|
|
75
|
+
template,
|
|
76
|
+
chat_status = 'active',
|
|
77
|
+
limit = 50,
|
|
78
|
+
offset = 0,
|
|
79
|
+
} = request
|
|
80
|
+
|
|
81
|
+
// Build query parameters
|
|
82
|
+
const params = new URLSearchParams()
|
|
83
|
+
if (project_id) params.append('project_id', project_id)
|
|
84
|
+
if (document_type) params.append('document_type', document_type)
|
|
85
|
+
if (template) params.append('template', template)
|
|
86
|
+
if (chat_status) params.append('chat_status', chat_status)
|
|
87
|
+
if (limit !== undefined) params.append('limit', limit.toString())
|
|
88
|
+
if (offset !== undefined) params.append('offset', offset.toString())
|
|
89
|
+
|
|
90
|
+
const queryString = params.toString()
|
|
91
|
+
const url = `/chat/document/list${queryString ? `?${queryString}` : ''}`
|
|
92
|
+
|
|
93
|
+
return this.get<ListDocumentChatsResponse>(url)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 5. GET /chat/document/by-document/{document_id}
|
|
98
|
+
* Get chat by specific document version ID (Legacy)
|
|
99
|
+
*
|
|
100
|
+
* @param request - Document ID to get chat for
|
|
101
|
+
* @returns Conversation and messages for the specific document
|
|
102
|
+
*/
|
|
103
|
+
async getChatByDocumentId(
|
|
104
|
+
request: GetChatByDocumentIdRequest
|
|
105
|
+
): Promise<GetChatByDocumentIdResponse> {
|
|
106
|
+
return this.get<GetChatByDocumentIdResponse>(
|
|
107
|
+
`/chat/document/by-document/${request.document_id}`
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Document Chat GET Endpoint Types
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// 1. GET /chat/document/types/{project_id}
|
|
7
|
+
// Get document types for UI grouping
|
|
8
|
+
// ============================================================================
|
|
9
|
+
|
|
10
|
+
export interface GetDocumentTypesRequest {
|
|
11
|
+
project_id: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface GetDocumentTypesResponse {
|
|
15
|
+
project_id: string
|
|
16
|
+
project_name: string
|
|
17
|
+
document_types: DocumentType[]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type DocumentType =
|
|
21
|
+
| 'project_requirements_document'
|
|
22
|
+
| 'app_flow_document'
|
|
23
|
+
| 'tech_stack_document'
|
|
24
|
+
| 'frontend_guidelines_document'
|
|
25
|
+
| 'database_schema_document'
|
|
26
|
+
| 'api_documentation_document'
|
|
27
|
+
| 'deployment_document'
|
|
28
|
+
| 'testing_document'
|
|
29
|
+
| 'custom_document'
|
|
30
|
+
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// 2. GET /chat/document/by-type/{project_id}/{document_type}
|
|
33
|
+
// List all chats for a specific document type (PRIMARY endpoint for UI)
|
|
34
|
+
// ============================================================================
|
|
35
|
+
|
|
36
|
+
export interface GetChatsByDocumentTypeRequest {
|
|
37
|
+
project_id: string
|
|
38
|
+
document_type: DocumentType
|
|
39
|
+
chat_status?: ChatStatus
|
|
40
|
+
limit?: number
|
|
41
|
+
offset?: number
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface GetChatsByDocumentTypeResponse {
|
|
45
|
+
chats: DocumentChatSummary[]
|
|
46
|
+
count: number
|
|
47
|
+
project_id: string
|
|
48
|
+
document_type: DocumentType
|
|
49
|
+
limit: number
|
|
50
|
+
offset: number
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// 3. GET /chat/document/history/{conversation_id}
|
|
55
|
+
// Get full chat history with messages
|
|
56
|
+
// ============================================================================
|
|
57
|
+
|
|
58
|
+
export interface GetChatHistoryRequest {
|
|
59
|
+
conversation_id: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface GetChatHistoryResponse {
|
|
63
|
+
conversation: DocumentConversation
|
|
64
|
+
messages: ChatMessage[]
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// 4. GET /chat/document/list
|
|
69
|
+
// List all chats for current user (with optional filters)
|
|
70
|
+
// ============================================================================
|
|
71
|
+
|
|
72
|
+
export interface ListDocumentChatsRequest {
|
|
73
|
+
project_id?: string
|
|
74
|
+
document_type?: DocumentType
|
|
75
|
+
template?: 'blueprint' | 'wireframe'
|
|
76
|
+
chat_status?: ChatStatus
|
|
77
|
+
limit?: number
|
|
78
|
+
offset?: number
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface ListDocumentChatsResponse {
|
|
82
|
+
chats: DocumentChatSummary[]
|
|
83
|
+
count: number
|
|
84
|
+
limit: number
|
|
85
|
+
offset: number
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ============================================================================
|
|
89
|
+
// 5. GET /chat/document/by-document/{document_id}
|
|
90
|
+
// Get chat by specific document version ID (Legacy)
|
|
91
|
+
// ============================================================================
|
|
92
|
+
|
|
93
|
+
export interface GetChatByDocumentIdRequest {
|
|
94
|
+
document_id: string
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface GetChatByDocumentIdResponse {
|
|
98
|
+
conversation: DocumentConversation
|
|
99
|
+
messages: ChatMessage[]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ============================================================================
|
|
103
|
+
// Common Types
|
|
104
|
+
// ============================================================================
|
|
105
|
+
|
|
106
|
+
export type ChatStatus = 'active' | 'archived' | 'deleted'
|
|
107
|
+
|
|
108
|
+
export interface DocumentChatSummary {
|
|
109
|
+
id: string
|
|
110
|
+
project_id: string
|
|
111
|
+
document_type: DocumentType
|
|
112
|
+
title: string
|
|
113
|
+
template: 'blueprint' | 'wireframe'
|
|
114
|
+
status: ChatStatus
|
|
115
|
+
last_message_at: string
|
|
116
|
+
metadata?: Record<string, any>
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface DocumentConversation {
|
|
120
|
+
id: string
|
|
121
|
+
project_id: string
|
|
122
|
+
document_type: DocumentType
|
|
123
|
+
title: string
|
|
124
|
+
template: 'blueprint' | 'wireframe'
|
|
125
|
+
status: ChatStatus
|
|
126
|
+
created_at: string
|
|
127
|
+
last_message_at: string
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface ChatMessage {
|
|
131
|
+
id: string
|
|
132
|
+
role: 'user' | 'assistant' | 'system'
|
|
133
|
+
content: string
|
|
134
|
+
tool_calls?: ChatToolCall[]
|
|
135
|
+
created_at: string
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface ChatToolCall {
|
|
139
|
+
id: string
|
|
140
|
+
type: string
|
|
141
|
+
function?: {
|
|
142
|
+
name: string
|
|
143
|
+
arguments: string
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -18,9 +18,21 @@ import {
|
|
|
18
18
|
GenerateMultipleDocumentsResponse,
|
|
19
19
|
GenerateMissingDocumentsRequest,
|
|
20
20
|
GenerateMissingDocumentsResponse,
|
|
21
|
+
GenerateTechSpecRequest,
|
|
22
|
+
CustomDocumentResponse,
|
|
21
23
|
BackgroundGenerationRequest,
|
|
22
24
|
BackgroundGenerationResponse,
|
|
23
25
|
BackgroundGenerationStatusResponse,
|
|
26
|
+
GenerateAnswersRequest,
|
|
27
|
+
GenerateAnswersResponse,
|
|
28
|
+
GenerateProjectOutlineRequest,
|
|
29
|
+
GenerateProjectOutlineResponse,
|
|
30
|
+
GenerateCoreFeaturesRequest,
|
|
31
|
+
GenerateCoreFeaturesResponse,
|
|
32
|
+
GenerateTechStackRequest,
|
|
33
|
+
GenerateTechStackResponse,
|
|
34
|
+
GenerateAppFlowRequest,
|
|
35
|
+
GenerateAppFlowResponse,
|
|
24
36
|
} from './generation-types'
|
|
25
37
|
|
|
26
38
|
export class GenerationService extends BaseService {
|
|
@@ -78,4 +90,32 @@ export class GenerationService extends BaseService {
|
|
|
78
90
|
async getBackgroundGenerationStatus(jobId: string): Promise<BackgroundGenerationStatusResponse> {
|
|
79
91
|
return this.get<BackgroundGenerationStatusResponse>(`/generate/background/${jobId}/status`)
|
|
80
92
|
}
|
|
93
|
+
|
|
94
|
+
async generateTechSpec(request: GenerateTechSpecRequest): Promise<CustomDocumentResponse> {
|
|
95
|
+
return this.post<CustomDocumentResponse>('/generate/tech-spec', request)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async generateAnswers(request: GenerateAnswersRequest): Promise<GenerateAnswersResponse> {
|
|
99
|
+
return this.post<GenerateAnswersResponse>('/generate/answers', request)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async generateProjectOutline(
|
|
103
|
+
request: GenerateProjectOutlineRequest
|
|
104
|
+
): Promise<GenerateProjectOutlineResponse> {
|
|
105
|
+
return this.post<GenerateProjectOutlineResponse>('/generate/project-outline', request)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async generateCoreFeatures(
|
|
109
|
+
request: GenerateCoreFeaturesRequest
|
|
110
|
+
): Promise<GenerateCoreFeaturesResponse> {
|
|
111
|
+
return this.post<GenerateCoreFeaturesResponse>('/generate/core-features', request)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async generateTechStack(request: GenerateTechStackRequest): Promise<GenerateTechStackResponse> {
|
|
115
|
+
return this.post<GenerateTechStackResponse>('/generate/tech-stack', request)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async generateAppFlow(request: GenerateAppFlowRequest): Promise<GenerateAppFlowResponse> {
|
|
119
|
+
return this.post<GenerateAppFlowResponse>('/generate/app-flow', request)
|
|
120
|
+
}
|
|
81
121
|
}
|
|
@@ -65,6 +65,7 @@ export interface GenerateOutlineResponse {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export interface GenerateDocumentRequest {
|
|
68
|
+
project_id?: string
|
|
68
69
|
project_type?: string
|
|
69
70
|
description: string
|
|
70
71
|
selected_tools: string[]
|
|
@@ -129,3 +130,112 @@ export interface GenerateMissingDocumentsResponse {
|
|
|
129
130
|
error?: string
|
|
130
131
|
generated_documents?: string[]
|
|
131
132
|
}
|
|
133
|
+
|
|
134
|
+
export interface GenerateTechSpecRequest {
|
|
135
|
+
project_id: string
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface CustomDocumentResponse {
|
|
139
|
+
content: string
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface GenerateAnswersRequest {
|
|
143
|
+
title: string
|
|
144
|
+
description: string
|
|
145
|
+
questions: Array<{
|
|
146
|
+
question: string
|
|
147
|
+
answer: string
|
|
148
|
+
}>
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface GenerateAnswersResponse {
|
|
152
|
+
answers: Array<{
|
|
153
|
+
question: string
|
|
154
|
+
answer: string
|
|
155
|
+
}>
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface GenerateProjectOutlineRequest {
|
|
159
|
+
description: string
|
|
160
|
+
project_type: string
|
|
161
|
+
title?: string
|
|
162
|
+
selected_tools?: string[]
|
|
163
|
+
answers?: Record<string, any>
|
|
164
|
+
project_id?: string
|
|
165
|
+
category_id?: string
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface GenerateProjectOutlineResponse {
|
|
169
|
+
outline: string
|
|
170
|
+
project_id: string
|
|
171
|
+
project_created: boolean
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface CoreFeature {
|
|
175
|
+
id: number
|
|
176
|
+
title: string
|
|
177
|
+
description: string
|
|
178
|
+
icon_key: string
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface GenerateCoreFeaturesRequest {
|
|
182
|
+
context: string
|
|
183
|
+
project_id?: string
|
|
184
|
+
existing_features?: Array<{
|
|
185
|
+
id: number
|
|
186
|
+
title: string
|
|
187
|
+
description: string
|
|
188
|
+
}>
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface GenerateCoreFeaturesResponse {
|
|
192
|
+
core_features: CoreFeature[]
|
|
193
|
+
project_id: string | null
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface TechStackItem {
|
|
197
|
+
id: number
|
|
198
|
+
type: string
|
|
199
|
+
name: string
|
|
200
|
+
icon_key: string
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface GenerateTechStackRequest {
|
|
204
|
+
context: string
|
|
205
|
+
project_id?: string
|
|
206
|
+
existing_items?: Array<{
|
|
207
|
+
id: number
|
|
208
|
+
type: string
|
|
209
|
+
name: string
|
|
210
|
+
}>
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface GenerateTechStackResponse {
|
|
214
|
+
tech_stack: TechStackItem[]
|
|
215
|
+
project_id: string | null
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface AppFlowItem {
|
|
219
|
+
id: number
|
|
220
|
+
title: string
|
|
221
|
+
page: string
|
|
222
|
+
description: string
|
|
223
|
+
index: number
|
|
224
|
+
icon_key: string
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface GenerateAppFlowRequest {
|
|
228
|
+
context: string
|
|
229
|
+
project_id?: string
|
|
230
|
+
existing_items?: Array<{
|
|
231
|
+
id: number
|
|
232
|
+
title: string
|
|
233
|
+
page: string
|
|
234
|
+
description: string
|
|
235
|
+
}>
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface GenerateAppFlowResponse {
|
|
239
|
+
app_flow: AppFlowItem[]
|
|
240
|
+
project_id: string | null
|
|
241
|
+
}
|
package/services/index.ts
CHANGED
|
@@ -21,6 +21,8 @@ export { ExternalTokenService } from './external-tokens'
|
|
|
21
21
|
export { SecurityKeysService } from './security-keys'
|
|
22
22
|
export { UserService } from './users'
|
|
23
23
|
export { StarterKitsService } from './starter-kits'
|
|
24
|
+
export { StreamingService } from './streaming'
|
|
25
|
+
export { ChatService } from './chat'
|
|
24
26
|
|
|
25
27
|
// Re-export all types for convenience
|
|
26
28
|
export * from './generation'
|
|
@@ -36,3 +38,5 @@ export * from './external-tokens'
|
|
|
36
38
|
export * from './security-keys'
|
|
37
39
|
export * from './users'
|
|
38
40
|
export * from './starter-kits'
|
|
41
|
+
export * from './streaming'
|
|
42
|
+
export * from './chat'
|
|
@@ -122,6 +122,60 @@ interface Project {
|
|
|
122
122
|
}
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
+
### Project Creation
|
|
126
|
+
|
|
127
|
+
#### `CreateProjectRequest`
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
interface CreateProjectRequest {
|
|
131
|
+
title?: string // Optional - will be auto-generated if not provided
|
|
132
|
+
description: string
|
|
133
|
+
status?: 'prompt' | 'draft' | 'in_progress' | 'completed'
|
|
134
|
+
category_id?: string
|
|
135
|
+
starter_kit_id?: string
|
|
136
|
+
ai_questionaire?: {
|
|
137
|
+
experience_level?: string
|
|
138
|
+
timeline?: string
|
|
139
|
+
team_size?: number
|
|
140
|
+
}
|
|
141
|
+
tools_selected?: string[]
|
|
142
|
+
project_outline?: {
|
|
143
|
+
features?: string[]
|
|
144
|
+
architecture?: string
|
|
145
|
+
}
|
|
146
|
+
codie_tool_id?: string
|
|
147
|
+
existing_project_repo_url?: string
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### Automatic Title Generation
|
|
152
|
+
|
|
153
|
+
The API now supports automatic title generation when creating projects without a title. The system generates titles using this priority order:
|
|
154
|
+
|
|
155
|
+
1. **Project description** (highest priority)
|
|
156
|
+
2. **AI questionnaire** responses
|
|
157
|
+
3. **Project outline** information
|
|
158
|
+
4. **"Untitled Project"** (fallback when no context is available)
|
|
159
|
+
|
|
160
|
+
#### Usage Examples
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// Create project without title - API will auto-generate
|
|
164
|
+
const newProject = await codeGuide.project.createProject({
|
|
165
|
+
description: "A todo app built with React and Node.js",
|
|
166
|
+
tools_selected: ["React", "Node.js", "MongoDB"]
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
// The API will generate a title like "React Node.js Todo Application"
|
|
170
|
+
console.log(newProject.title) // Auto-generated title
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### Generated Title Examples
|
|
174
|
+
|
|
175
|
+
- Input: "A todo app built with React and Node.js" → "React Node.js Todo Application"
|
|
176
|
+
- Input: "Mobile banking app with biometric authentication" → "Mobile Banking App Biometric Authentication"
|
|
177
|
+
- Empty description with questionnaire → "Untitled Project" (fallback)
|
|
178
|
+
|
|
125
179
|
## Usage Examples
|
|
126
180
|
|
|
127
181
|
### Basic Filtering
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
GetProjectDocumentsResponse,
|
|
13
13
|
ConnectRepositoryRequest,
|
|
14
14
|
ConnectRepositoryResponse,
|
|
15
|
+
GetAiToolsRequest,
|
|
16
|
+
GetAiToolsResponse,
|
|
15
17
|
} from './project-types'
|
|
16
18
|
|
|
17
19
|
export class ProjectService extends BaseService {
|
|
@@ -49,7 +51,7 @@ export class ProjectService extends BaseService {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
async createProject(request: CreateProjectRequest): Promise<Project> {
|
|
52
|
-
const response = await this.post<ProjectResponse>('/projects', request)
|
|
54
|
+
const response = await this.post<ProjectResponse>('/projects/', request)
|
|
53
55
|
return response.data
|
|
54
56
|
}
|
|
55
57
|
|
|
@@ -76,6 +78,13 @@ export class ProjectService extends BaseService {
|
|
|
76
78
|
return this.get<GetProjectDocumentsResponse>(url)
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
async getDocumentsByType(
|
|
82
|
+
projectId: string,
|
|
83
|
+
documentType: string
|
|
84
|
+
): Promise<GetProjectDocumentsResponse> {
|
|
85
|
+
return this.get<GetProjectDocumentsResponse>(`/projects/${projectId}/documents/type/${documentType}`)
|
|
86
|
+
}
|
|
87
|
+
|
|
79
88
|
async connectRepository(
|
|
80
89
|
projectId: string,
|
|
81
90
|
request: ConnectRepositoryRequest
|
|
@@ -110,4 +119,14 @@ export class ProjectService extends BaseService {
|
|
|
110
119
|
throw new Error('GitHub token must be a valid personal access token')
|
|
111
120
|
}
|
|
112
121
|
}
|
|
122
|
+
|
|
123
|
+
async getAiTools(params?: GetAiToolsRequest): Promise<GetAiToolsResponse> {
|
|
124
|
+
const queryParams = new URLSearchParams()
|
|
125
|
+
|
|
126
|
+
if (params?.key) queryParams.append('key', params.key)
|
|
127
|
+
if (params?.category) queryParams.append('category', params.category)
|
|
128
|
+
|
|
129
|
+
const url = `/ai-tools${queryParams.toString() ? `?${queryParams.toString()}` : ''}`
|
|
130
|
+
return this.get<GetAiToolsResponse>(url)
|
|
131
|
+
}
|
|
113
132
|
}
|
|
@@ -95,8 +95,9 @@ export interface StarterKitReference {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export interface CreateProjectRequest {
|
|
98
|
-
title
|
|
98
|
+
title?: string // Optional - will be auto-generated if not provided
|
|
99
99
|
description: string
|
|
100
|
+
status?: 'prompt' | 'draft' | 'in_progress' | 'completed'
|
|
100
101
|
category_id?: string
|
|
101
102
|
starter_kit_id?: string
|
|
102
103
|
ai_questionaire?: {
|
|
@@ -178,3 +179,28 @@ export interface ConnectRepositoryResponse {
|
|
|
178
179
|
data: ProjectRepository
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
export interface AITool {
|
|
183
|
+
id: string
|
|
184
|
+
created_at: string
|
|
185
|
+
name: string
|
|
186
|
+
description: string
|
|
187
|
+
logo_src: string | null
|
|
188
|
+
is_active: boolean
|
|
189
|
+
key: string
|
|
190
|
+
ordinal: number | null
|
|
191
|
+
metadata: Record<string, any> | null
|
|
192
|
+
detailed_description: string | null
|
|
193
|
+
category: string | null
|
|
194
|
+
doc_type: string
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface GetAiToolsRequest {
|
|
198
|
+
key?: string
|
|
199
|
+
category?: string
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface GetAiToolsResponse {
|
|
203
|
+
status: string
|
|
204
|
+
data: AITool[]
|
|
205
|
+
}
|
|
206
|
+
|