Add Frappe Data Transfer Endpoint and Test Harness for FastAPI Integration#2
Open
aiworkhackshop-design wants to merge 5 commits intoOpenNyAI:mainfrom
Open
Conversation
Implement summarization API with fallback to naive summarizer when no OpenAI key is set, and add /transfer/frappe endpoint using httpx and environment variables for secure Frappe API forwarding.
Include fastapi, uvicorn[standard], pydantic, langchain, langchain-openai, httpx for summarization and Frappe endpoints.
Provide Dockerfile to build and run the Next.js app in development mode. Copies dependencies and sets default command to npm run dev.
Provide an asynchronous test script to verify summarization and Frappe transfer endpoints using environment variables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request implements a generic data-transfer endpoint (
POST /transfer/frappe) on the FastAPI backend to fulfil the C4GT bounty requirement for bridging a FastAPI service with a Frappe-based management system.Key points
FrappeTransferInputdefinesdoctypeandpayloadso that any Frappe DocType can be created by simply posting JSON.FRAPPE_API_BASE_URL,FRAPPE_API_KEYandFRAPPE_API_SECRETfrom environment variables; no secrets are hard-coded.httpxclient with atoken key:secretheader to authenticate against Frappe. It propagates non-200 responses asHTTPExceptionso clients receive clear error messages.502 Bad Gatewayif the Frappe instance is unreachable.test_frappe_transfer.py, which demonstrates how to hit the new endpoint and prints the JSON response. It first exercises the summarization endpoint and then sends a sample payload to Frappe.This change satisfies the bounty requirement to send JSON from a FastAPI service into a Frappe management system. With a properly configured Frappe environment, the endpoint will create or update documents without further modifications.