Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/FOUR-15004: PMQL in record list doesnt work with pm variables: #6934

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "processmaker/processmaker",
"version": "4.10.2-RC1",
"version": "4.11.0+alpha-1",
"description": "BPM PHP Software",
"keywords": [
"php bpm processmaker"
Expand Down Expand Up @@ -103,7 +103,7 @@
"Gmail"
],
"processmaker": {
"build": "1417049f",
"build": "bd988db1",
"custom": {
"package-ellucian-ethos": "1.16.0",
"package-plaid": "1.6.0",
Expand Down Expand Up @@ -134,42 +134,42 @@
"package-plg": "0.0.3"
},
"enterprise": {
"connector-docusign": "1.9.0",
"connector-idp": "1.9.4",
"connector-pdf-print": "1.16.1",
"connector-send-email": "1.26.3",
"connector-slack": "1.8.0",
"connector-docusign": "1.10.0",
"connector-idp": "1.10.0",
"connector-pdf-print": "1.17.0",
"connector-send-email": "1.27.0",
"connector-slack": "1.9.0",
"docker-executor-cdata": "1.4.1",
"docker-executor-node-ssr": "1.5.0",
"package-ab-testing": "1.1.0",
"package-actions-by-email": "1.17.0",
"package-ab-testing": "1.2.0",
"package-actions-by-email": "1.18.0",
"package-advanced-user-manager": "1.11.0",
"package-ai": "1.8.0",
"package-ai": "1.9.0",
"package-analytics-reporting": "1.7.0",
"package-auth": "1.19.0",
"package-cdata": "1.4.4",
"package-collections": "2.17.0",
"package-collections": "2.18.0",
"package-comments": "1.13.0",
"package-conversational-forms": "1.8.1",
"package-data-sources": "1.27.0",
"package-conversational-forms": "1.9.0",
"package-data-sources": "1.28.0",
"package-decision-engine": "1.9.15",
"package-dynamic-ui": "1.20.0",
"package-files": "1.16.0",
"package-googleplaces": "1.11.0",
"package-dynamic-ui": "1.21.0",
"package-files": "1.17.0",
"package-googleplaces": "1.12.0",
"package-photo-video": "1.5.1",
"package-pm-blocks": "1.6.7",
"package-process-documenter": "1.9.0",
"package-pm-blocks": "1.7.0",
"package-process-documenter": "1.10.0",
"package-process-optimization": "1.10.0",
"package-product-analytics": "1.5.8",
"package-projects": "1.3.1",
"package-savedsearch": "1.34.0",
"package-sentry": "1.8.0",
"package-savedsearch": "1.35.0",
"package-sentry": "1.9.0",
"package-signature": "1.12.0",
"package-testing": "1.3.0",
"package-translations": "2.9.0",
"package-versions": "1.10.1",
"package-vocabularies": "2.15.2",
"package-webentry": "2.21.2",
"package-translations": "2.10.0",
"package-versions": "1.11.0",
"package-vocabularies": "2.16.0",
"package-webentry": "2.22.0",
"packages": "^0"
},
"docker-executors": {
Expand All @@ -180,7 +180,7 @@
"microservices": {
"pmai": "fall-2023"
},
"release": "Spring 2024 Release Candidate"
"release": "Summer 2024 Alpha"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 12 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@processmaker/processmaker",
"version": "4.10.2-RC1",
"version": "4.11.0+alpha-1",
"description": "ProcessMaker 4",
"author": "DevOps <[email protected]>",
"license": "ISC",
Expand Down Expand Up @@ -37,6 +37,7 @@
"moment": "^2.30.1",
"moment-timezone": "^0.5.45",
"resolve-url-loader": "^3.1.2",
"sass": "^1.77.4",
"sass-loader": "^12.6.0",
"vue-loader": "^15.10.0"
},
Expand Down
3 changes: 3 additions & 0 deletions public/images/Stroke.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 54 additions & 4 deletions resources/js/components/shared/PmqlInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ export default {
promptTokens: 0,
totalTokens: 0,
},
promptSessionId: "",
currentNonce: "",
get,
};
},
Expand Down Expand Up @@ -312,6 +314,9 @@ export default {
this.filtersPmql = this.filtersValue;
this.inputAriaLabel = this.ariaLabel;

this.promptSessionId = localStorage.promptSessionId;
this.currentNonce = localStorage.currentNonce;

this.$root.$on("bv::collapse::state", (collapseId, isJustShown) => {
this.query = this.value;
this.pmql = this.value;
Expand All @@ -325,6 +330,48 @@ export default {
},

methods: {
getNonce() {
const max = 999999999999999;
const nonce = Math.floor(Math.random() * max);
this.currentNonce = nonce;
localStorage.currentNonce = this.currentNonce;
},
getPromptSession() {
const url = "/package-ai/getPromptSessionHistory";

let params = {
server: window.location.host,
};

if (this.promptSessionId?.startsWith("ss")) {
this.promptSessionId = "";
}

if (
this.promptSessionId
&& this.promptSessionId !== null
&& this.promptSessionId !== ""
) {
params = {
promptSessionId: this.promptSessionId,
};
}

ProcessMaker.apiClient
.post(url, params)
.then((response) => {
this.promptSessionId = response.data.promptSessionId;
localStorage.promptSessionId = response.data.promptSessionId;
this.runNLQToPMQL();
})
.catch((error) => {
if (error.response.status === 404) {
localStorage.promptSessionId = "";
this.promptSessionId = "";
this.getPromptSession();
}
});
},
onFiltersPmqlChange(value) {
this.filtersPmql = value[0];
this.selectedFilters = value[1];
Expand Down Expand Up @@ -381,7 +428,7 @@ export default {
this.$emit("submit", this.query);
this.$emit("input", this.query);
} else if (this.aiEnabledLocal) {
this.runNLQToPMQL();
this.getPromptSession();
} else if (!this.query.isPMQL() && !this.aiEnabledLocal) {
const fullTextSearch = `(fulltext LIKE "%${this.query}%")`;
this.pmql = fullTextSearch;
Expand All @@ -395,19 +442,22 @@ export default {
this.runSearch();
},
runNLQToPMQL() {
this.getNonce();
const params = {
question: this.query,
search: this.query,
type: this.searchType,
classifySearch: false,
promptSessionId: this.promptSessionId,
nonce: this.currentNonce,
};

this.aiLoading = true;

ProcessMaker.apiClient
.post("/package-ai/naturalLanguageToPmql", params)
.then((response) => {
this.pmql = response.data.result;
this.usage = response.data.usage;
this.pmql = response.data.result[0].result.pmql;
this.usage = response.data.result[0].usage;
this.$emit("submit", this.pmql);
this.$emit("input", this.pmql);
this.aiLoading = false;
Expand Down
Loading