Feat/google docs plan step v0 [INTEG-3341]#10360
Feat/google docs plan step v0 [INTEG-3341]#10360david-shibley-contentful wants to merge 14 commits intomasterfrom
Conversation
* wip * simplify agent * organize oauth functions * reorganizing function handlers * reorganizing function handlers (prev `createEntriesfromDocument`) calling each agent in a separate function, + removing plan agent for now * fix: function manifest * minor edit to manifest * replacing single function with 2: one for analyzing ct + one for document processing * fix: add oauth token to analyze content type function * fix: adding entries to document processor o/p * feat: new app action to create entries, preview modal * cleanup + rename preview function * cleanup * chore: delete test docs * cleanup * rename handler for consistency
* feat: got google doc picker working * feat: explicitly add api key for google docs oauth connection
| const analyzeContentTypesResponse = await analyzeContentTypesAction( | ||
| sdk, | ||
| contentTypeIds, | ||
| oauthToken | ||
| ); | ||
| console.log('analyzeContentTypesResponse', analyzeContentTypesResponse); | ||
| // If entries provided, use them directly. Otherwise fetch document JSON as fallback | ||
| let documentJson: unknown | undefined; | ||
| if (!entries || entries.length === 0) { | ||
| documentJson = await fetchGoogleDocAsJson(documentId, oauthToken); | ||
| } | ||
|
|
||
| const processDocumentResponse = await createPreviewAction( | ||
| const response = await createEntriesFromDocumentAction( | ||
| sdk, | ||
| contentTypeIds, | ||
| documentId, | ||
| oauthToken | ||
| ); | ||
| console.log('processDocumentResponse', processDocumentResponse); | ||
| entries, | ||
| documentJson | ||
| ) as any; | ||
| const result: FinalEntriesResult = response.sys.result; |
There was a problem hiding this comment.
should we revert to using two functions instead of one?
There was a problem hiding this comment.
i'm not sure I understand, aren't we using two functions?
There was a problem hiding this comment.
I looked into it and the createPreview function only calls the document parser agent and not the content type parser agent (this agent was called by the analyzeContentTypes function that was deleted in the manifest) Was that intentional? If so we would need to delete the content type parser agent.
|
|
||
| const submit = useCallback( | ||
| async (contentTypeIds: string[]) => { | ||
| async (contentTypeIds: string[], entries?: any[]) => { |
There was a problem hiding this comment.
Why do we have a diff here? Isn't this part for the content type analysis, but now we are fetching the docs and calling create entries? I think this is not what this hook is intended for
There was a problem hiding this comment.
no?
| }, [isSubmitting, modalStates.isLoadingModalOpen, closeModal, clearPlan]); | ||
|
|
||
| // Handle plan generation completion | ||
| useEffect(() => { |
There was a problem hiding this comment.
where did this come from
There was a problem hiding this comment.
we need this to get the modals to switch when the preview is generated
bf31297 to
6c505b7
Compare
Purpose
The preview step was the final missing piece of the flow
Things introduced in this PR:
Approach
Testing steps
Breaking Changes
Dependencies and/or References
Deployment