mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-28 10:26:33 +02:00
feat: no login experience and prem tokens
Some checks are pending
Build and Push Docker Images / tag_release (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web) (push) Blocked by required conditions
Some checks are pending
Build and Push Docker Images / tag_release (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web) (push) Blocked by required conditions
This commit is contained in:
parent
87452bb315
commit
ff4e0f9b62
68 changed files with 5914 additions and 121 deletions
49
surfsense_web/contracts/types/anonymous-chat.types.ts
Normal file
49
surfsense_web/contracts/types/anonymous-chat.types.ts
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import { z } from "zod";
|
||||
|
||||
export const anonModel = z.object({
|
||||
id: z.number(),
|
||||
name: z.string(),
|
||||
description: z.string().nullable().optional(),
|
||||
provider: z.string(),
|
||||
model_name: z.string(),
|
||||
billing_tier: z.string().default("free"),
|
||||
is_premium: z.boolean().default(false),
|
||||
seo_slug: z.string().nullable().optional(),
|
||||
seo_enabled: z.boolean().default(false),
|
||||
seo_title: z.string().nullable().optional(),
|
||||
seo_description: z.string().nullable().optional(),
|
||||
quota_reserve_tokens: z.number().nullable().optional(),
|
||||
});
|
||||
|
||||
export const getAnonModelsResponse = z.array(anonModel);
|
||||
|
||||
export const getAnonModelResponse = anonModel;
|
||||
|
||||
export const anonQuotaResponse = z.object({
|
||||
used: z.number(),
|
||||
limit: z.number(),
|
||||
remaining: z.number(),
|
||||
status: z.string(),
|
||||
warning_threshold: z.number(),
|
||||
captcha_required: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export const anonChatRequest = z.object({
|
||||
model_slug: z.string().max(100),
|
||||
messages: z
|
||||
.array(
|
||||
z.object({
|
||||
role: z.enum(["system", "user", "assistant"]),
|
||||
content: z.string(),
|
||||
})
|
||||
)
|
||||
.min(1),
|
||||
disabled_tools: z.array(z.string()).optional(),
|
||||
turnstile_token: z.string().optional(),
|
||||
});
|
||||
|
||||
export type AnonModel = z.infer<typeof anonModel>;
|
||||
export type GetAnonModelsResponse = z.infer<typeof getAnonModelsResponse>;
|
||||
export type GetAnonModelResponse = z.infer<typeof getAnonModelResponse>;
|
||||
export type AnonQuotaResponse = z.infer<typeof anonQuotaResponse>;
|
||||
export type AnonChatRequest = z.infer<typeof anonChatRequest>;
|
||||
|
|
@ -162,6 +162,16 @@ export const globalNewLLMConfig = z.object({
|
|||
|
||||
is_global: z.literal(true),
|
||||
is_auto_mode: z.boolean().optional().default(false), // True only for Auto mode (ID 0)
|
||||
|
||||
// Token quota and billing policy
|
||||
billing_tier: z.string().default("free"),
|
||||
is_premium: z.boolean().default(false),
|
||||
anonymous_enabled: z.boolean().default(false),
|
||||
seo_enabled: z.boolean().default(false),
|
||||
seo_slug: z.string().nullable().optional(),
|
||||
seo_title: z.string().nullable().optional(),
|
||||
seo_description: z.string().nullable().optional(),
|
||||
quota_reserve_tokens: z.number().nullable().optional(),
|
||||
});
|
||||
|
||||
export const getGlobalNewLLMConfigsResponse = z.array(globalNewLLMConfig);
|
||||
|
|
|
|||
|
|
@ -32,9 +32,48 @@ export const getPagePurchasesResponse = z.object({
|
|||
purchases: z.array(pagePurchase),
|
||||
});
|
||||
|
||||
// Premium token purchases
|
||||
export const createTokenCheckoutSessionRequest = z.object({
|
||||
quantity: z.number().int().min(1).max(100),
|
||||
search_space_id: z.number().int().min(1),
|
||||
});
|
||||
|
||||
export const createTokenCheckoutSessionResponse = z.object({
|
||||
checkout_url: z.string(),
|
||||
});
|
||||
|
||||
export const tokenStripeStatusResponse = z.object({
|
||||
token_buying_enabled: z.boolean(),
|
||||
premium_tokens_used: z.number().default(0),
|
||||
premium_tokens_limit: z.number().default(0),
|
||||
premium_tokens_remaining: z.number().default(0),
|
||||
});
|
||||
|
||||
export const tokenPurchase = z.object({
|
||||
id: z.uuid(),
|
||||
stripe_checkout_session_id: z.string(),
|
||||
stripe_payment_intent_id: z.string().nullable(),
|
||||
quantity: z.number(),
|
||||
tokens_granted: z.number(),
|
||||
amount_total: z.number().nullable(),
|
||||
currency: z.string().nullable(),
|
||||
status: z.string(),
|
||||
completed_at: z.string().nullable(),
|
||||
created_at: z.string(),
|
||||
});
|
||||
|
||||
export const getTokenPurchasesResponse = z.object({
|
||||
purchases: z.array(tokenPurchase),
|
||||
});
|
||||
|
||||
export type PagePurchaseStatus = z.infer<typeof pagePurchaseStatusEnum>;
|
||||
export type CreateCheckoutSessionRequest = z.infer<typeof createCheckoutSessionRequest>;
|
||||
export type CreateCheckoutSessionResponse = z.infer<typeof createCheckoutSessionResponse>;
|
||||
export type StripeStatusResponse = z.infer<typeof stripeStatusResponse>;
|
||||
export type PagePurchase = z.infer<typeof pagePurchase>;
|
||||
export type GetPagePurchasesResponse = z.infer<typeof getPagePurchasesResponse>;
|
||||
export type CreateTokenCheckoutSessionRequest = z.infer<typeof createTokenCheckoutSessionRequest>;
|
||||
export type CreateTokenCheckoutSessionResponse = z.infer<typeof createTokenCheckoutSessionResponse>;
|
||||
export type TokenStripeStatusResponse = z.infer<typeof tokenStripeStatusResponse>;
|
||||
export type TokenPurchase = z.infer<typeof tokenPurchase>;
|
||||
export type GetTokenPurchasesResponse = z.infer<typeof getTokenPurchasesResponse>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue