-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4fff2f
commit ac491d4
Showing
29 changed files
with
1,044 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,29 @@ | ||
lm_models: | ||
- label: "default" | ||
name: "OpenAI" | ||
args: | ||
model: "gpt-3.5-turbo" | ||
max_tokens: 4096 | ||
- label: "fast" | ||
name: "OpenAI" | ||
args: | ||
model: "gpt-3.5-turbo" | ||
max_tokens: 2048 | ||
- label: "slow" | ||
name: "T5Large" | ||
args: | ||
model: "fine-tuned-t5-large-1234" | ||
max_tokens: 100 | ||
|
||
rm_models: | ||
- label: "default" | ||
name: "ColBERTv2" | ||
- label: "product_features" | ||
name: "prd_feats.csv" | ||
- label: "user_feedback" | ||
name: "db://user_feedback" | ||
query: "SELECT * FROM user_feedback" | ||
|
||
signatures: | ||
- name: "ProcessDataSignature" | ||
docstring: "Processes raw data to synthesize into a structured format suitable for report generation." | ||
inputs: | ||
- name: "raw_data" | ||
desc: "Raw data input that needs processing." | ||
- name: "data_format" | ||
desc: "The desired format of the output data." | ||
outputs: | ||
- name: "processed_data" | ||
desc: "Data processed into a structured format." | ||
- name: "GenerateReportSignature" | ||
docstring: "Generates a comprehensive report from structured data." | ||
- name: "GenerateGherkinSignature" | ||
docstring: "Generates a comprehensive gherkin from structured data." | ||
inputs: | ||
- name: "processed_data" | ||
desc: "Structured data to be included in the report." | ||
- name: "report_template" | ||
desc: "Template specifying the report's format and structure." | ||
desc: "Structured data to be included in the gherkin." | ||
outputs: | ||
- name: "report" | ||
desc: "The final report generated from the structured data." | ||
- name: "gherkin" | ||
desc: "The final gherkin generated from the structured data." | ||
|
||
lm_modules: | ||
- name: "DataProcessorModule" | ||
signature: "ProcessDataSignature" | ||
predictor: "Predict" | ||
args: | ||
- name: "raw_data" | ||
value: "{{ user_input }}" | ||
- name: "data_format" | ||
value: "JSON" | ||
|
||
- name: "ReportGeneratorModule" | ||
signature: "GenerateReportSignature" | ||
- name: "GherkinGeneratorModule" | ||
signature: "GenerateGherkinSignature" | ||
predictor: "ChainOfThought" | ||
args: | ||
- name: "report_template" | ||
value: "StandardReportTemplate" | ||
- name: "gherkin_scenarios" | ||
value: "StandardGherkinTemplate" | ||
|
||
steps: | ||
- module: "DataProcessorModule" | ||
lm_model: "default" | ||
args: | ||
raw_data: "id, name, age\n1, John, 25\n2, Jane, 30" | ||
data_format: "YAML" | ||
- file: "feature_list.yaml" | ||
|
||
- module: "ReportGeneratorModule" | ||
- module: "GherkinGeneratorModule" | ||
lm_model: "fast" | ||
args: | ||
processed_data: "{{ processed_data }}" | ||
report_template: "templates/standard_report.html" | ||
processed_data: "{{ processed_data }}" |
This file contains 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
Empty file.
96 changes: 96 additions & 0 deletions
96
src/dspygen/experiments/react_code_gen/api-for-document-management.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import axios from 'axios'; | ||
|
||
interface Document { | ||
id: string; | ||
name: string; | ||
url: string; | ||
} | ||
|
||
const DocumentManagement: React.FC = () => { | ||
const [documents, setDocuments] = useState<Document[]>([]); | ||
const [loading, setLoading] = useState<boolean>(false); | ||
const [error, setError] = useState<string>(''); | ||
|
||
useEffect(() => { | ||
setLoading(true); | ||
axios | ||
.get('/api/documents') | ||
.then((res) => { | ||
setDocuments(res.data); | ||
setLoading(false); | ||
}) | ||
.catch((err) => { | ||
setError(err.message); | ||
setLoading(false); | ||
}); | ||
}, []); | ||
|
||
const uploadDocument = (file: File) => { | ||
setLoading(true); | ||
const formData = new FormData(); | ||
formData.append('file', file); | ||
axios | ||
.post('/api/documents', formData) | ||
.then((res) => { | ||
setDocuments([...documents, res.data]); | ||
setLoading(false); | ||
}) | ||
.catch((err) => { | ||
setError(err.message); | ||
setLoading(false); | ||
}); | ||
}; | ||
|
||
const downloadDocument = (id: string) => { | ||
setLoading(true); | ||
axios | ||
.get(`/api/documents/${id}`) | ||
.then((res) => { | ||
const link = document.createElement('a'); | ||
link.href = res.data.url; | ||
link.download = res.data.name; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
setLoading(false); | ||
}) | ||
.catch((err) => { | ||
setError(err.message); | ||
setLoading(false); | ||
}); | ||
}; | ||
|
||
const deleteDocument = (id: string) => { | ||
setLoading(true); | ||
axios | ||
.delete(`/api/documents/${id}`) | ||
.then(() => { | ||
setDocuments(documents.filter((doc) => doc.id !== id)); | ||
setLoading(false); | ||
}) | ||
.catch((err) => { | ||
setError(err.message); | ||
setLoading(false); | ||
}); | ||
}; | ||
|
||
return ( | ||
<div> | ||
{loading && <p>Loading...</p>} | ||
{error && <p>{error}</p>} | ||
<input type="file" onChange={(e) => uploadDocument(e.target.files[0])} /> | ||
<ul> | ||
{documents.map((doc) => ( | ||
<li key={doc.id}> | ||
<p>{doc.name}</p> | ||
<button onClick={() => downloadDocument(doc.id)}>Download</button> | ||
<button onClick={() => deleteDocument(doc.id)}>Delete</button> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DocumentManagement; |
26 changes: 26 additions & 0 deletions
26
src/dspygen/experiments/react_code_gen/confirm-signature-placement.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React, { useState } from 'react'; | ||
|
||
interface SignaturePlacementProps { | ||
document: Document; | ||
} | ||
|
||
const SignaturePlacement: React.FC<SignaturePlacementProps> = ({ document }) => { | ||
const [signature, setSignature] = useState<Signature | null>(null); | ||
|
||
const handleSignatureFieldClick = (event: React.MouseEvent<HTMLDivElement>) => { | ||
const signatureField = event.currentTarget; | ||
const signature = document.getSignature(signatureField.id); | ||
setSignature(signature); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Document document={document} /> | ||
<SignatureField onClick={handleSignatureFieldClick} /> | ||
{signature && <SignaturePreview signature={signature} />} | ||
</div> | ||
); | ||
}; | ||
|
||
export default SignaturePlacement; | ||
``` |
22 changes: 22 additions & 0 deletions
22
src/dspygen/experiments/react_code_gen/custom-signing-instructions.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React, { useState } from 'react'; | ||
|
||
const CustomSigningInstructions = () => { | ||
const [customInstructions, setCustomInstructions] = useState(''); | ||
|
||
const handleCustomInstructionsChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
setCustomInstructions(e.target.value); | ||
}; | ||
|
||
const handleSaveCustomInstructions = () => { | ||
// save custom instructions | ||
}; | ||
|
||
return ( | ||
<div> | ||
<button onClick={handleSaveCustomInstructions}>Add Custom Instructions</button> | ||
<input type="text" value={customInstructions} onChange={handleCustomInstructionsChange} /> | ||
<p>{customInstructions}</p> | ||
</div> | ||
); | ||
}; | ||
``` |
18 changes: 18 additions & 0 deletions
18
src/dspygen/experiments/react_code_gen/document-download.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
const DocumentDownload = () => { | ||
const [downloaded, setDownloaded] = useState(false); | ||
|
||
useEffect(() => { | ||
if (downloaded) { | ||
// download document | ||
} | ||
}, [downloaded]); | ||
|
||
return ( | ||
<div> | ||
<button onClick={() => setDownloaded(true)}>Download</button> | ||
</div> | ||
); | ||
}; | ||
``` |
104 changes: 104 additions & 0 deletions
104
src/dspygen/experiments/react_code_gen/document-preview.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import React, { useState } from 'react'; | ||
import DocumentPreview from './DocumentPreview'; | ||
|
||
const DocumentPreviewPage = () => { | ||
const [document, setDocument] = useState(null); | ||
const [showPreview, setShowPreview] = useState(false); | ||
const [showPrintOptions, setShowPrintOptions] = useState(false); | ||
const [showShareOptions, setShowShareOptions] = useState(false); | ||
const [showDownloadOptions, setShowDownloadOptions] = useState(false); | ||
const [selectedShareOption, setSelectedShareOption] = useState(null); | ||
const [selectedPrintOption, setSelectedPrintOption] = useState(null); | ||
|
||
const handleDocumentClick = () => { | ||
setShowPreview(true); | ||
}; | ||
|
||
const handlePreviewClose = () => { | ||
setShowPreview(false); | ||
}; | ||
|
||
const handlePrintClick = () => { | ||
setShowPrintOptions(true); | ||
}; | ||
|
||
const handlePrintOptionSelect = (option) => { | ||
setSelectedPrintOption(option); | ||
}; | ||
|
||
const handlePrint = () => { | ||
// send document to printer with selected options | ||
}; | ||
|
||
const handleShareClick = () => { | ||
setShowShareOptions(true); | ||
}; | ||
|
||
const handleShareOptionSelect = (option) => { | ||
setSelectedShareOption(option); | ||
}; | ||
|
||
const handleShare = () => { | ||
// share document through selected option | ||
}; | ||
|
||
const handleDownloadClick = () => { | ||
setShowDownloadOptions(true); | ||
}; | ||
|
||
const handleDownload = () => { | ||
// download document to user's device | ||
}; | ||
|
||
return ( | ||
<div> | ||
<h1>Document Preview Page</h1> | ||
<button onClick={handleDocumentClick}>Click to view document</button> | ||
{showPreview && ( | ||
<DocumentPreview | ||
document={document} | ||
onClose={handlePreviewClose} | ||
onPrint={handlePrintClick} | ||
onShare={handleShareClick} | ||
onDownload={handleDownloadClick} | ||
/> | ||
)} | ||
{showPrintOptions && ( | ||
<div> | ||
<h2>Select printing options:</h2> | ||
<select onChange={handlePrintOptionSelect}> | ||
<option value="option1">Option 1</option> | ||
<option value="option2">Option 2</option> | ||
<option value="option3">Option 3</option> | ||
</select> | ||
<button onClick={handlePrint}>Print</button> | ||
</div> | ||
)} | ||
{showShareOptions && ( | ||
<div> | ||
<h2>Select sharing option:</h2> | ||
<select onChange={handleShareOptionSelect}> | ||
<option value="option1">Option 1</option> | ||
<option value="option2">Option 2</option> | ||
<option value="option3">Option 3</option> | ||
</select> | ||
<button onClick={handleShare}>Share</button> | ||
</div> | ||
)} | ||
{showDownloadOptions && ( | ||
<div> | ||
<h2>Select download option:</h2> | ||
<select> | ||
<option value="option1">Option 1</option> | ||
<option value="option2">Option 2</option> | ||
<option value="option3">Option 3</option> | ||
</select> | ||
<button onClick={handleDownload}>Download</button> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DocumentPreviewPage; | ||
``` |
Oops, something went wrong.