Merge remote-tracking branch 'origin/dev' into swiftyos/open-2278-implement-agent-preset-functionality

This commit is contained in:
SwiftyOS
2025-02-03 15:49:23 +01:00
12 changed files with 54 additions and 30 deletions

View File

@@ -66,10 +66,17 @@ We use the Poetry to manage the dependencies. To set up the project, follow thes
### Starting the server without Docker
To run the server locally, start in the autogpt_platform folder:
```sh
cd ..
```
Run the following command to run database in docker but the application locally:
```sh
docker compose --profile local up deps --build --detach
cd backend
poetry run app
```

View File

@@ -399,16 +399,12 @@ class UserCredit(UserCreditBase):
f"Top up amount must be at least 500 credits and multiple of 100 but is {amount}"
)
if not (user := await get_user_by_id(user_id)):
raise ValueError(f"User not found: {user_id}")
# Create checkout session
# https://docs.stripe.com/checkout/quickstart?client=react
# unit_amount param is always in the smallest currency unit (so cents for usd)
# which is equal to amount of credits
checkout_session = stripe.checkout.Session.create(
customer=await get_stripe_customer_id(user_id),
customer_email=user.email,
line_items=[
{
"price_data": {
@@ -422,13 +418,13 @@ class UserCredit(UserCreditBase):
}
],
mode="payment",
ui_mode="hosted",
payment_intent_data={"setup_future_usage": "off_session"},
saved_payment_method_options={"payment_method_save": "enabled"},
success_url=settings.config.platform_base_url
success_url=settings.config.frontend_base_url
+ "/marketplace/credits?topup=success",
cancel_url=settings.config.platform_base_url
cancel_url=settings.config.frontend_base_url
+ "/marketplace/credits?topup=cancel",
return_url=settings.config.platform_base_url + "/marketplace/credits",
)
await self._add_transaction(
@@ -602,8 +598,6 @@ def get_block_costs() -> dict[str, list[BlockCost]]:
async def get_stripe_customer_id(user_id: str) -> str:
user = await get_user_by_id(user_id)
if not user:
raise ValueError(f"User not found: {user_id}")
if user.stripeCustomerId:
return user.stripeCustomerId
@@ -624,8 +618,6 @@ async def set_auto_top_up(user_id: str, config: AutoTopUpConfig):
async def get_auto_top_up(user_id: str) -> AutoTopUpConfig:
user = await get_user_by_id(user_id)
if not user:
raise ValueError("Invalid user ID")
if not user.topUpConfig:
return AutoTopUpConfig(threshold=0, amount=0)

View File

@@ -34,9 +34,11 @@ async def get_or_create_user(user_data: dict) -> User:
return User.model_validate(user)
async def get_user_by_id(user_id: str) -> Optional[User]:
async def get_user_by_id(user_id: str) -> User:
user = await prisma.user.find_unique(where={"id": user_id})
return User.model_validate(user) if user else None
if not user:
raise ValueError(f"User not found with ID: {user_id}")
return User.model_validate(user)
async def create_default_user() -> Optional[User]:

View File

@@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 2.0.0 and should not be changed by hand.
# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand.
[[package]]
name = "aio-pika"
@@ -5050,4 +5050,4 @@ type = ["pytest-mypy"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.10,<3.13"
content-hash = "9a40ee57d7440f352b0ac0a138fa26d05cd8eadb0cf7d3a0f995fb3c36a2fa7c"
content-hash = "0f7dda46ad3cce4486a3ca4162babff974bd270c100c7b82b1ff8dec563488ad"

View File

@@ -55,7 +55,7 @@ sqlalchemy = "^2.0.36"
psycopg2-binary = "^2.9.10"
google-cloud-storage = "^2.18.2"
launchdarkly-server-sdk = "^9.8.0"
mem0ai = "^0.1.44"
mem0ai = "^0.1.48"
todoist-api-python = "^2.1.7"
moviepy = "^2.1.2"

View File

@@ -203,6 +203,9 @@ export default function CreditsPage() {
executions are happening.
</p>
<br />
{transactionHistory.transactions.length === 0 && (
<p className="text-neutral-600">No transactions found.</p>
)}
<Table
className={
transactionHistory.transactions.length === 0 ? "hidden" : ""

View File

@@ -25,10 +25,10 @@ export async function signup(values: z.infer<typeof signupFormSchema>) {
console.error("Error signing up", error);
// FIXME: supabase doesn't return the correct error message for this case
if (error.message.includes("P0001")) {
return "Please join our waitlist for your turn: https://agpt.co/waitlist";
return "not_allowed";
}
if (error.code?.includes("user_already_exists")) {
redirect("/login");
if (error.code === "user_already_exists") {
return "user_already_exists";
}
return error.message;
}

View File

@@ -34,6 +34,7 @@ export default function SignupPage() {
const [feedback, setFeedback] = useState<string | null>(null);
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
//TODO: Remove after closed beta
const [showWaitlistPrompt, setShowWaitlistPrompt] = useState(false);
const form = useForm<z.infer<typeof signupFormSchema>>({
@@ -58,10 +59,16 @@ export default function SignupPage() {
const error = await signup(data);
setIsLoading(false);
if (error) {
setShowWaitlistPrompt(true);
if (error === "user_already_exists") {
setFeedback("User with this email already exists");
return;
} else {
setShowWaitlistPrompt(true);
}
return;
}
setFeedback(null);
setShowWaitlistPrompt(false);
},
[form],
);

View File

@@ -71,15 +71,14 @@ export const StoreCard: React.FC<StoreCardProps> = ({
{/* Content Section */}
<div className="w-full px-2 py-4">
{/* Title and Creator */}
<h3 className="font-poppins mb-2 text-2xl font-semibold leading-tight text-[#272727] dark:text-neutral-100">
<h3 className="font-poppins mb-0.5 text-2xl font-semibold leading-tight text-[#272727] dark:text-neutral-100">
{agentName}
</h3>
{!hideAvatar && creatorName && (
<p className="font-lead mb-4 text-base font-normal text-neutral-600 dark:text-neutral-400">
<p className="font-lead mb-2.5 text-base font-normal text-neutral-600 dark:text-neutral-400">
by {creatorName}
</p>
)}
{/* Description */}
<p className="font-geist mb-4 line-clamp-3 text-base font-normal leading-normal text-neutral-600 dark:text-neutral-400">
{description}

View File

@@ -16,24 +16,24 @@ export const HeroSection: React.FC = () => {
return (
<div className="mb-2 mt-8 flex flex-col items-center justify-center px-4 sm:mb-4 sm:mt-12 sm:px-6 md:mb-6 md:mt-16 lg:my-24 lg:px-8 xl:my-16">
<div className="w-full max-w-3xl lg:max-w-4xl xl:max-w-5xl">
<div className="8md:mb-8 mb-4 text-center">
<div className="mb-4 text-center md:mb-8">
<h1 className="text-center">
<span className="font-poppins text-5xl font-semibold leading-[54px] text-neutral-950 dark:text-neutral-50">
<span className="font-poppin text-[48px] font-semibold leading-[54px] text-neutral-950 dark:text-neutral-50">
Explore AI agents built for{" "}
</span>
<span className="font-poppins text-5xl font-semibold leading-[54px] text-violet-600">
<span className="font-poppin text-[48px] font-semibold leading-[54px] text-violet-600">
you
</span>
<br />
<span className="font-poppins text-5xl font-semibold leading-[54px] text-neutral-950 dark:text-neutral-50">
<span className="font-poppin text-[48px] font-semibold leading-[54px] text-neutral-950 dark:text-neutral-50">
by the{" "}
</span>
<span className="font-poppins text-5xl font-semibold leading-[54px] text-blue-500">
<span className="font-poppin text-[48px] font-semibold leading-[54px] text-blue-500">
community
</span>
</h1>
</div>
<h3 className="mb:text-2xl font-geist mb-6 text-center text-xl font-normal leading-loose text-neutral-700 dark:text-neutral-300 md:mb-12">
<h3 className="mb:text-2xl mb-6 text-center font-sans text-xl font-normal leading-loose text-neutral-700 dark:text-neutral-300 md:mb-12">
Bringing you AI agents designed by thinkers from around the world
</h3>
<div className="mb-4 flex justify-center sm:mb-5 md:mb-6">

View File

@@ -662,6 +662,20 @@ export const NodeGenericInputField: FC<{
handleInputClick={handleInputClick}
/>
);
case "object":
return (
<NodeKeyValueInput
nodeId={nodeId}
selfKey={propKey}
schema={propSchema}
entries={currentValue}
errors={errors}
className={className}
displayName={displayName}
connections={connections}
handleInputChange={handleInputChange}
/>
);
default:
console.warn(
`Schema for '${propKey}' specifies unknown type:`,

View File

@@ -70,7 +70,7 @@ export type BlockIOObjectSubSchema = BlockIOSubSchemaMeta & {
export type BlockIOKVSubSchema = BlockIOSubSchemaMeta & {
type: "object";
additionalProperties: { type: "string" | "number" | "integer" };
additionalProperties?: { type: "string" | "number" | "integer" };
default?: { [key: string]: string | number };
secret?: boolean;
};