@powerhousedao/contributor-billing 0.1.34 → 0.1.36
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/dist/editors/invoice/ingestPDF.js +1 -1
- package/dist/editors/invoice/invoiceToGnosis.js +1 -1
- package/dist/editors/invoice/requestFinance.js +1 -1
- package/dist/editors/invoice/uploadPdfChunked.d.ts.map +1 -1
- package/dist/editors/invoice/uploadPdfChunked.js +8 -1
- package/dist/scripts/invoice/pdfToClaudeAI.d.ts.map +1 -1
- package/dist/scripts/invoice/pdfToClaudeAI.js +3 -1
- package/dist/subgraphs/invoice-addon/customResolvers.js +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import { getCountryCodeFromName, mapChainNameToConfig } from "./utils/utils.js";
|
|
|
7
7
|
import { LoaderCircle } from "lucide-react";
|
|
8
8
|
let GRAPHQL_URL = "http://localhost:4001/graphql";
|
|
9
9
|
if (!window.document.baseURI.includes("localhost")) {
|
|
10
|
-
GRAPHQL_URL = "https://switchboard
|
|
10
|
+
GRAPHQL_URL = "https://switchboard.powerhouse.xyz/graphql";
|
|
11
11
|
}
|
|
12
12
|
export async function loadPDFFile({ file, dispatch, }) {
|
|
13
13
|
if (!file)
|
|
@@ -4,7 +4,7 @@ import { actions } from "../../document-models/invoice/index.js";
|
|
|
4
4
|
import { generateId } from "document-model";
|
|
5
5
|
let GRAPHQL_URL = "http://localhost:4001/graphql";
|
|
6
6
|
if (!window.document.baseURI.includes('localhost')) {
|
|
7
|
-
GRAPHQL_URL = 'https://switchboard
|
|
7
|
+
GRAPHQL_URL = 'https://switchboard.powerhouse.xyz/graphql';
|
|
8
8
|
}
|
|
9
9
|
const InvoiceToGnosis = ({ docState, dispatch, }) => {
|
|
10
10
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -4,7 +4,7 @@ import { actions } from "../../document-models/invoice/index.js";
|
|
|
4
4
|
import { generateId } from "document-model";
|
|
5
5
|
let GRAPHQL_URL = "http://localhost:4001/graphql";
|
|
6
6
|
if (!window.document.baseURI.includes('localhost')) {
|
|
7
|
-
GRAPHQL_URL = 'https://switchboard
|
|
7
|
+
GRAPHQL_URL = 'https://switchboard.powerhouse.xyz/graphql';
|
|
8
8
|
}
|
|
9
9
|
const RequestFinance = ({ docState, dispatch, }) => {
|
|
10
10
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadPdfChunked.d.ts","sourceRoot":"","sources":["../../../editors/invoice/uploadPdfChunked.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,MAAoB,EAC9B,SAAS,GAAE,MAAmB,EAAE,eAAe;AAC/C,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GACtC,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"uploadPdfChunked.d.ts","sourceRoot":"","sources":["../../../editors/invoice/uploadPdfChunked.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,MAAoB,EAC9B,SAAS,GAAE,MAAmB,EAAE,eAAe;AAC/C,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GACtC,OAAO,CAAC,GAAG,CAAC,CAyFd"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
let GRAPHQL_URL = "http://localhost:4001/graphql";
|
|
9
9
|
if (!window.document.baseURI.includes('localhost')) {
|
|
10
|
-
GRAPHQL_URL = 'https://switchboard
|
|
10
|
+
GRAPHQL_URL = 'https://switchboard.powerhouse.xyz/graphql';
|
|
11
11
|
}
|
|
12
12
|
export async function uploadPdfChunked(pdfData, endpoint = GRAPHQL_URL, chunkSize = 500 * 1024, // 500KB chunks
|
|
13
13
|
onProgress) {
|
|
@@ -23,11 +23,17 @@ onProgress) {
|
|
|
23
23
|
const start = i * chunkSize;
|
|
24
24
|
const end = Math.min(start + chunkSize, pdfData.length);
|
|
25
25
|
const chunk = pdfData.substring(start, end);
|
|
26
|
+
// Create an AbortController with a longer timeout for the last chunk
|
|
27
|
+
// since that's when Claude processing happens
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
const timeoutMs = i === totalChunks - 1 ? 120000 : 30000; // 2 minutes for last chunk, 30s for others
|
|
30
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
26
31
|
const response = await fetch(endpoint, {
|
|
27
32
|
method: "POST",
|
|
28
33
|
headers: {
|
|
29
34
|
"Content-Type": "application/json",
|
|
30
35
|
},
|
|
36
|
+
signal: controller.signal,
|
|
31
37
|
body: JSON.stringify({
|
|
32
38
|
query: `
|
|
33
39
|
mutation Invoice_uploadInvoicePdfChunk(
|
|
@@ -59,6 +65,7 @@ onProgress) {
|
|
|
59
65
|
},
|
|
60
66
|
}),
|
|
61
67
|
});
|
|
68
|
+
clearTimeout(timeoutId);
|
|
62
69
|
const result = await response.json();
|
|
63
70
|
results.push(result);
|
|
64
71
|
// Call progress callback if provided
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdfToClaudeAI.d.ts","sourceRoot":"","sources":["../../../scripts/invoice/pdfToClaudeAI.ts"],"names":[],"mappings":"AA4LA,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,MAAM;;
|
|
1
|
+
{"version":3,"file":"pdfToClaudeAI.d.ts","sourceRoot":"","sources":["../../../scripts/invoice/pdfToClaudeAI.ts"],"names":[],"mappings":"AA4LA,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,MAAM;;GAsR/D"}
|
|
@@ -328,8 +328,10 @@ Extract only the data that is clearly visible in the PDF. If a field is not pres
|
|
|
328
328
|
|
|
329
329
|
IMPORTANT: You MUST output valid, complete JSON. Do not truncate or abbreviate the output. Include all line items.
|
|
330
330
|
`;
|
|
331
|
+
// Use Haiku for faster processing to avoid gateway timeouts
|
|
332
|
+
// Haiku is significantly faster than Sonnet while still being capable for invoice extraction
|
|
331
333
|
const requestBody = {
|
|
332
|
-
model: "claude-
|
|
334
|
+
model: "claude-haiku-4-5-20251001",
|
|
333
335
|
max_tokens: 32000,
|
|
334
336
|
messages: [
|
|
335
337
|
{
|
|
@@ -141,7 +141,7 @@ export const Invoice_uploadInvoicePdfChunk = async (_, args) => {
|
|
|
141
141
|
const responseData = {
|
|
142
142
|
invoiceData: claudeResult.invoiceData,
|
|
143
143
|
processingMetadata: {
|
|
144
|
-
provider: "claude-
|
|
144
|
+
provider: "claude-haiku-4-5-20251001",
|
|
145
145
|
processingTimeMs: processingTime,
|
|
146
146
|
processingTimestamp: new Date().toISOString(),
|
|
147
147
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/contributor-billing",
|
|
3
3
|
"description": "Document models that help contributors of open organisations get paid anonymously for their work on a monthly basis.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.36",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|