(run: any)
| 39 | }; |
| 40 | |
| 41 | export const getCodeExamples = async (run: any) => { |
| 42 | const fetchGithubFile = async (path: string) => { |
| 43 | const response = await fetch( |
| 44 | `https://raw.githubusercontent.com/Surfer-Org/Protocol/main/${path}` |
| 45 | ); |
| 46 | return response.text(); |
| 47 | }; |
| 48 | |
| 49 | const claudePath = 'cookbook/python/claude-mcp/README.md'; |
| 50 | const claudeCode = await fetchGithubFile(claudePath); |
| 51 | console.log(claudeCode); |
| 52 | |
| 53 | const dashboardPath = 'cookbook/python/streamlit-chatbot/app.py'; |
| 54 | const dashboardCode = await fetchGithubFile(dashboardPath); |
| 55 | |
| 56 | const knowledgeGraphPath = 'cookbook/python/knowledge-graph/app.py'; |
| 57 | const knowledgeGraphCode = await fetchGithubFile(knowledgeGraphPath); |
| 58 | |
| 59 | return { |
| 60 | dashboard: { |
| 61 | code: dashboardCode, |
| 62 | githubUrl: `${GITHUB_BASE_URL}/${dashboardPath}` |
| 63 | }, |
| 64 | knowledge_graph: { |
| 65 | code: knowledgeGraphCode, |
| 66 | githubUrl: `${GITHUB_BASE_URL}/${knowledgeGraphPath}` |
| 67 | }, |
| 68 | claude: { |
| 69 | code: claudeCode, |
| 70 | githubUrl: `${GITHUB_BASE_URL}/${claudePath}` |
| 71 | } |
| 72 | }; |
| 73 | }; |
| 74 | |
| 75 | export const getLanguageFromFilename = (filename: string): string => { |
| 76 | const extension = filename.split('.').pop()?.toLowerCase(); |
no test coverage detected