Merge remote-tracking branch 'origin/dev' into dev_juan
commit
b2ecc1a4e8
|
|
@ -54,8 +54,9 @@ export async function handleResetButton() {
|
|||
dialog.show();
|
||||
}
|
||||
|
||||
export async function changeOnAWS(disableAWS) {
|
||||
export async function changeOnAWS(disableAWS, checkbox) {
|
||||
var target
|
||||
var isChecked = checkbox.checked;
|
||||
if (disableAWS === false) {
|
||||
var dialog = new ModalConfirmDialog(app, 'Do you want to DISABLE cloud prompt?', async () => {
|
||||
try {
|
||||
|
|
@ -67,6 +68,7 @@ export async function changeOnAWS(disableAWS) {
|
|||
});
|
||||
} catch (exception) {
|
||||
}
|
||||
checkbox.checked = false;
|
||||
});
|
||||
dialog.show();
|
||||
} else {
|
||||
|
|
@ -80,9 +82,11 @@ export async function changeOnAWS(disableAWS) {
|
|||
});
|
||||
} catch (exception) {
|
||||
}
|
||||
checkbox.checked = true;
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
checkbox.checked = !isChecked;
|
||||
return disableAWS;
|
||||
}
|
||||
|
||||
|
|
@ -508,10 +512,7 @@ function createWorkflowItem(workflow, onClick) {
|
|||
async function handlePromptChange(event) {
|
||||
console.log(`Checkbox ${event.target.checked ? 'checked' : 'unchecked'}`);
|
||||
// Handle checkbox change
|
||||
changeOnAWS(event.target.checked);
|
||||
// const response = await api.fetchApi("/get_env");
|
||||
// const data = await response.json();
|
||||
// event.target.checked = data.env.toUpperCase() === 'FALSE';
|
||||
changeOnAWS(event.target.checked, event.target);
|
||||
}
|
||||
|
||||
async function handleLoadJson(templateId){
|
||||
|
|
@ -706,9 +707,10 @@ export class ModalBlankDialog extends ComfyDialog {
|
|||
}
|
||||
|
||||
|
||||
|
||||
var newWorkflowName = '';
|
||||
// input field dialog
|
||||
export class ModalReleaseDialog extends ComfyDialog {
|
||||
|
||||
constructor(app) {
|
||||
super();
|
||||
this.app = app;
|
||||
|
|
@ -735,6 +737,8 @@ export class ModalReleaseDialog extends ComfyDialog {
|
|||
type: "text",
|
||||
id: "input-field",
|
||||
style: { width: "100%", border: "0" },
|
||||
value: "",
|
||||
oninput: (event) => this.handleInputChange(event),
|
||||
})
|
||||
]),
|
||||
]
|
||||
|
|
@ -783,17 +787,20 @@ export class ModalReleaseDialog extends ComfyDialog {
|
|||
this.element.showModal();
|
||||
}
|
||||
|
||||
handleInputChange(event) {
|
||||
newWorkflowName = event.target.value;
|
||||
}
|
||||
|
||||
async releaseWorkflow() {
|
||||
const inputValue = document.getElementById("input-field").value;
|
||||
// validate names
|
||||
if (inputValue.length > 40) {
|
||||
if (newWorkflowName.length > 40) {
|
||||
document.getElementById("release-validate").textContent = 'The workflow name cannot exceed 40 characters.';
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the input value contains only English letters, numbers, and underscores
|
||||
const nameRegex = /^[a-zA-Z0-9_]+$/;
|
||||
if (!nameRegex.test(inputValue)) {
|
||||
if (!nameRegex.test(newWorkflowName)) {
|
||||
document.getElementById("release-validate").textContent = 'The workflow name must only contain letters, numbers, and underscores.';
|
||||
return;
|
||||
}
|
||||
|
|
@ -809,7 +816,7 @@ export class ModalReleaseDialog extends ComfyDialog {
|
|||
console.log(payloadJson)
|
||||
|
||||
var target = {
|
||||
'name': inputValue,
|
||||
'name': newWorkflowName,
|
||||
'payload_json': payloadJson
|
||||
};
|
||||
const response = await api.fetchApi("/workflows", {
|
||||
|
|
@ -829,10 +836,12 @@ export class ModalReleaseDialog extends ComfyDialog {
|
|||
handleUnlockScreen();
|
||||
document.getElementById("release-validate").textContent = errorMessage;
|
||||
}
|
||||
newWorkflowName = '';
|
||||
}
|
||||
|
||||
handleCancelClick() {
|
||||
this.element.close();
|
||||
newWorkflowName = ''
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -893,7 +902,6 @@ export class ModalConfirmDialog extends ComfyDialog {
|
|||
}
|
||||
|
||||
handleYesClick() {
|
||||
|
||||
this.callback();
|
||||
this.element.close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ SAGEMAKER_PORT = 8080
|
|||
LOCALHOST = '0.0.0.0'
|
||||
PHY_LOCALHOST = '127.0.0.1'
|
||||
|
||||
SLEEP_TIME = 60
|
||||
SLEEP_TIME = 5
|
||||
TIME_OUT_TIME = 86400
|
||||
MAX_KEEPALIVE_CONNECTIONS = 100
|
||||
MAX_CONNECTIONS = 1500
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_dynamodb, aws_lambda, aws_sqs, Duration } from 'aws-cdk-lib';
|
||||
import {aws_dynamodb, aws_lambda, aws_sqs, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway';
|
||||
import { Table } from 'aws-cdk-lib/aws-dynamodb';
|
||||
import { Role } from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, LayerVersion, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
import { Topic } from 'aws-cdk-lib/aws-sns';
|
||||
import { Construct } from 'constructs';
|
||||
import { ESD_ROLE } from '../../shared/const';
|
||||
import { ApiModels } from '../../shared/models';
|
||||
import {
|
||||
SCHEMA_DEBUG,
|
||||
|
|
@ -26,6 +25,7 @@ import {
|
|||
SCHEMA_MESSAGE, SCHEMA_WORKFLOW_NAME,
|
||||
} from '../../shared/schema';
|
||||
import { ApiValidators } from '../../shared/validator';
|
||||
import {ESD_ROLE} from "../../shared/const";
|
||||
|
||||
export interface CreateEndpointApiProps {
|
||||
router: Resource;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_apigateway, aws_dynamodb, aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway';
|
||||
import {Role} from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_apigateway, aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_apigateway, aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway';
|
||||
import {Role} from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import {
|
||||
JsonSchemaType,
|
||||
JsonSchemaVersion,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_apigateway, aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_apigateway, aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway';
|
||||
import {Role} from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway';
|
||||
import { Table } from 'aws-cdk-lib/aws-dynamodb';
|
||||
import { Role } from 'aws-cdk-lib/aws-iam';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway';
|
||||
import { Table } from 'aws-cdk-lib/aws-dynamodb';
|
||||
import { Role } from 'aws-cdk-lib/aws-iam';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_apigateway, aws_dynamodb, aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway';
|
||||
import {Role} from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway';
|
||||
import { Table } from 'aws-cdk-lib/aws-dynamodb';
|
||||
import { Role } from 'aws-cdk-lib/aws-iam';
|
||||
|
|
@ -10,8 +10,8 @@ import {
|
|||
SCHEMA_DEBUG,
|
||||
SCHEMA_MESSAGE, SCHEMA_WORKFLOW_JSON_WORKFLOW
|
||||
} from "../../shared/schema";
|
||||
import {ESD_ROLE} from "../../shared/const";
|
||||
import {ApiValidators} from "../../shared/validator";
|
||||
import {ESD_ROLE} from "../../shared/const";
|
||||
|
||||
export interface UpdateSchemaApiProps {
|
||||
router: Resource;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway';
|
||||
import { Role } from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, LayerVersion, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { Duration } from 'aws-cdk-lib';
|
||||
import {Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, RestApi } from 'aws-cdk-lib/aws-apigateway';
|
||||
import { Role } from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, LayerVersion, Runtime, Tracing } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_apigateway, aws_dynamodb, aws_kms, aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_apigateway, aws_dynamodb, aws_kms, aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway';
|
||||
import {Role} from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_apigateway, aws_dynamodb, aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway';
|
||||
import {Role} from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_apigateway, aws_dynamodb, aws_kms, aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_apigateway, aws_dynamodb, aws_kms, aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway';
|
||||
import {Role} from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway';
|
||||
import { Table } from 'aws-cdk-lib/aws-dynamodb';
|
||||
import { Role } from 'aws-cdk-lib/aws-iam';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model, Resource } from 'aws-cdk-lib/aws-apigateway';
|
||||
import { Table } from 'aws-cdk-lib/aws-dynamodb';
|
||||
import { Role } from 'aws-cdk-lib/aws-iam';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { PythonFunction } from '@aws-cdk/aws-lambda-python-alpha';
|
||||
import { aws_apigateway, aws_dynamodb, aws_lambda, Duration } from 'aws-cdk-lib';
|
||||
import {aws_apigateway, aws_dynamodb, aws_lambda, Duration} from 'aws-cdk-lib';
|
||||
import { JsonSchemaType, JsonSchemaVersion, LambdaIntegration, Model } from 'aws-cdk-lib/aws-apigateway';
|
||||
import {Role} from 'aws-cdk-lib/aws-iam';
|
||||
import { Architecture, Runtime } from 'aws-cdk-lib/aws-lambda';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import {ESD_VERSION} from './version';
|
||||
import {ESD_VERSION} from "./version";
|
||||
|
||||
export const KEY_ALIAS = 'sd-extension-password-key';
|
||||
export const STACK_ID = 'Extension-for-Stable-Diffusion-on-AWS';
|
||||
export const SOLUTION_NAME = 'comfy-aws-extension';
|
||||
export const ESD_ROLE = `ESDRoleForEndpoint-${ESD_VERSION}`;
|
||||
export const ESD_VERSION_MAIN = ESD_VERSION.split('-')[0];
|
||||
export const ESD_ROLE = `ESDRole-${ESD_VERSION_MAIN}`;
|
||||
export const ESD_POLICY_DOCUMENT = {
|
||||
Version: '2012-10-17',
|
||||
Statement: [{
|
||||
|
|
|
|||
|
|
@ -66,8 +66,6 @@ export async function handler(event: Event, context: Object) {
|
|||
async function createAndCheckResources() {
|
||||
await createRegionRole(ESD_ROLE);
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
// todo will remove in the next major version, current to keep old endpoint
|
||||
await createRegionRole(`ESDRoleForEndpoint-${AWS_REGION}`);
|
||||
|
||||
await createBucket();
|
||||
await createTables();
|
||||
|
|
@ -1425,7 +1423,7 @@ async function createRegionRole(role_name: string) {
|
|||
// Define policy documents for each service
|
||||
await iamClient.send(new PutRolePolicyCommand({
|
||||
RoleName: role_name,
|
||||
PolicyName: `${role_name}-policy`,
|
||||
PolicyName: `Policy`,
|
||||
PolicyDocument: JSON.stringify(ESD_POLICY_DOCUMENT),
|
||||
}));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue