Skip to content

Commit 2f427cb

Browse files
committed
Merge main branch into mcp branch
- Resolved conflicts in .env.example, package.json, src/app.css, generation-config.svelte, projects.svelte.ts, and business.svelte.ts - Updated Svelte to v5.36.16 - Added @tailwindcss/typography plugin - Integrated MCP functionality with main branch features including extra params and Parse Markdown toggle - Removed deleted context_length.json file - Regenerated pnpm-lock.yaml with updated dependencies
2 parents ae0bc2e + 78dcd5a commit 2f427cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2810
-1992
lines changed

.prettierrc.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
22
arrowParens: "avoid",
33
quoteProps: "consistent",
4-
trailingComma: "es5",
4+
trailingComma: "all",
55
useTabs: true,
66
tabWidth: 2,
77
printWidth: 120,

AGENTS.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Agent Guidelines for inference-playground
2+
3+
## Build/Test/Lint Commands
4+
5+
- `npm run dev` - Start development server
6+
- `npm run build` - Build for production
7+
- `npm run lint` - Run prettier and eslint checks
8+
- `npm run format` - Format code with prettier
9+
- `npm run check` - Run svelte-check for type checking
10+
- `npm run test` or `npm run test:unit` - Run unit tests with vitest
11+
- `npm run test:e2e` - Run e2e tests with playwright
12+
13+
## Code Style Guidelines
14+
15+
- **Formatting**: Uses tabs (tabWidth: 2), printWidth: 120, trailing commas, avoid arrow parens
16+
- **Imports**: Use `.js` extensions for local imports (enforced by custom eslint rule)
17+
- **Path aliases**: Use `$lib/` for src/lib imports
18+
- **Types**: Strict TypeScript with `noUncheckedIndexedAccess`, no explicit `any` allowed
19+
- **Naming**: Use camelCase for variables/functions, PascalCase for components/classes
20+
- **Files**: `.svelte` for components, `.svelte.ts` for reactive state files
21+
- **Icons**: Import from `~icons/carbon/` or `~icons/lucide/` or other unplugin-icons import
22+
- **Error handling**: Use try/catch blocks, display user-friendly error messages via toasts
23+
- **State**: Use Svelte 5 runes (`$state`, `$derived`) and reactive patterns
24+
- **Unused vars**: Prefix with `_` to ignore eslint warnings
25+
- **Object syntax**: Use object shorthand notation when possible
26+
27+
## Svelte general guidelines
28+
29+
### 1. **General Code Style**
30+
31+
- **Use Svelte 5 with runes** for all component state and reactivity.
32+
- **Use snake_case** for all variable, function, and file names.
33+
- **Do not use snake_case** for type/interface names; use **PascalCase** instead.
34+
- **Do not use the `any` type** anywhere in the codebase.
35+
- **Do not prefix private class properties with an underscore**.
36+
- **Use `const` by default**; use `let` only when reassignment is necessary.
37+
- **Prefer explicit over implicit**: always be clear about what your code is doing.
38+
39+
### 2. **Component Structure**
40+
41+
- **One component per file**. Name the file after the component, using kebab-case.
42+
- **Export only what is necessary** from each file.
43+
44+
### 3. **Reactivity and State**
45+
46+
- **Use runes for all reactivity** (`$state`, `$derived`, etc.).
47+
- **Avoid using Svelte’s legacy `$:` label**; prefer runes-based reactivity.
48+
- **Keep state as local as possible**; lift state up only when needed.
49+
- Dont start the dev server.
50+
- **Dont use $app/stores**; use $app/state
51+
- \*\*Dont use on:click handler; use the native onclick. this counts for all events.
52+
- \*\*Dont use :global in the style blocks.
53+
54+
### 4. **TypeScript Practices**
55+
56+
- **Use TypeScript for all code**.
57+
- **Never use `any`**. Use `unknown` or proper types/interfaces.
58+
- **Type names must be PascalCase** (e.g., `UserProfile`).
59+
- **Prefer type inference** where possible, but always type function arguments and return values.
60+
61+
### 5. **Class and Object Practices**
62+
63+
- **Do not prefix private properties with an underscore**.
64+
- **Favor composition over inheritance**.
65+
66+
### 6. **File and Folder Organization**
67+
68+
- **Use kebab-case for all file and folder names**.
69+
- **Group related components, stores, and helpers** in folders.
70+
- **Keep a flat structure unless complexity demands nesting**.
71+
72+
### 7. **Comments and Documentation**
73+
74+
- **Write clear, concise comments** for complex logic.
75+
- **Use JSDoc for function and class documentation**.
76+
- **Remove commented-out code** before merging.
77+
78+
### 8. **Testing and Linting**
79+
80+
- **Write tests for all logic-heavy code** (use your preferred testing framework).
81+
- **Use a linter and formatter** (e.g., ESLint, Prettier) with rules enforcing the above conventions.
82+
83+
### 9. **Other Good Practices**
84+
85+
- **Avoid magic numbers and strings**; use constants.
86+
- **Handle errors gracefully**; never swallow errors silently.
87+
- **Keep dependencies up to date** and avoid unnecessary packages.
88+
89+
- https://svelte.dev/docs/svelte/llms.txt
90+
- https://svelte.dev/docs/kit/llms.txt

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:alpine
1+
FROM node:22
22

33
# Install pnpm
44
RUN npm install -g pnpm

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,28 @@ Follow these steps to get the Inference Playground running on your local machine
6969
- **Configuration:** Adjust generation parameters like temperature, max tokens, and top-p.
7070
- **Session Management:** Save and load your conversation setups using Projects and Checkpoints.
7171
- **Code Snippets:** Generate code snippets for various languages to replicate your inference calls.
72+
- **Organization Billing:** Specify an organization to bill usage to for Team and Enterprise accounts.
73+
74+
## Organization Billing
75+
76+
For Team and Enterprise Hugging Face Hub organizations, you can centralize billing for all users by specifying an organization to bill usage to. This feature allows:
77+
78+
- **Centralized Billing:** All inference requests can be billed to your organization instead of individual user accounts
79+
- **Usage Tracking:** Track inference usage across your organization from the organization's billing page
80+
- **Spending Controls:** Organization administrators can set spending limits and manage provider access
81+
82+
### How to Use Organization Billing
83+
84+
1. **In the UI:** Navigate to the settings panel and enter your organization name in the "Billing Organization" field
85+
2. **In Code Snippets:** Generated code examples will automatically include the billing organization parameter
86+
3. **API Integration:** The playground will include the `X-HF-Bill-To` header in API requests when an organization is specified
87+
88+
### Requirements
89+
90+
- You must be a member of a Team or Enterprise Hugging Face Hub organization
91+
- The organization must have billing enabled
92+
- You need appropriate permissions to bill usage to the organization
93+
94+
For more information about organization billing, see the [Hugging Face documentation](https://huggingface.co/docs/inference-providers/pricing#billing-for-team-and-enterprise-organizations).
7295
7396
We hope you find the Inference Playground useful for exploring and experimenting with language models!

e2e/home.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test.describe.serial("Token Handling and Subsequent Tests", () => {
3030
});
3131

3232
// Nested describe for tests that use the saved state
33-
test.describe("Tests requiring persisted token", () => {
33+
test.describe.skip("Tests requiring persisted token", () => {
3434
test.use({ storageState: STORAGE_STATE_FILE });
3535

3636
test("can create a conversation with persisted token", async ({ page }) => {
@@ -42,7 +42,7 @@ test.describe.serial("Token Handling and Subsequent Tests", () => {
4242
// Verify token is in localStorage
4343
const storedToken = await page.evaluate(
4444
key => JSON.parse(window.localStorage.getItem(key) ?? ""),
45-
HF_TOKEN_STORAGE_KEY
45+
HF_TOKEN_STORAGE_KEY,
4646
);
4747
expect(storedToken).toBe(HF_TOKEN);
4848

@@ -67,7 +67,7 @@ test.describe.serial("Token Handling and Subsequent Tests", () => {
6767
const assistantMsg = "assistant message: hey";
6868

6969
// Fill user message
70-
await page.getByRole("textbox", { name: "Enter user message" }).click();
70+
await page.getByRole("textbox", { name: "Enter message" }).click();
7171
await page.getByRole("textbox", { name: "Enter user message" }).fill(userMsg);
7272
// Blur
7373
await page.locator(".relative > div:nth-child(2) > div").first().click();

eslint.config.mts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export default ts.config(
3232
// While certain Svelte settings may be statically loaded from svelte.config.js even if you don’t specify it,
3333
// explicitly specifying it ensures better compatibility and functionality.
3434
svelteConfig,
35+
svelteFeatures: {
36+
experimentalGenerics: true,
37+
},
3538
},
3639
},
3740
},
@@ -58,6 +61,8 @@ export default ts.config(
5861
},
5962
],
6063

64+
"@typescript-eslint/no-this-alias": "off",
65+
6166
"object-shorthand": ["error", "always"],
6267
"svelte/no-at-html-tags": "off",
6368
"svelte/require-each-key": "off",
@@ -97,5 +102,5 @@ export default ts.config(
97102
...globals.node,
98103
},
99104
},
100-
}
105+
},
101106
);

package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
6-
"dev": "pnpm run update-ctx-length && vite dev",
7-
"build": "pnpm run update-ctx-length && vite build",
6+
"dev": "vite dev",
7+
"build": "vite build",
88
"preview": "vite preview",
99
"prepare": "ts-patch install && svelte-kit sync || echo ''",
1010
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
@@ -21,10 +21,10 @@
2121
"@eslint/eslintrc": "^3.3.0",
2222
"@eslint/js": "^9.22.0",
2323
"@floating-ui/dom": "^1.6.13",
24-
"@huggingface/hub": "^2.1.0",
25-
"@huggingface/inference": "^3.13.2",
26-
"@huggingface/tasks": "^0.19.8",
27-
"@huggingface/transformers": "^3.5.1",
24+
"@huggingface/hub": "^2.4.0",
25+
"@huggingface/inference": "^4.5.3",
26+
"@huggingface/tasks": "^0.19.26",
27+
"@huggingface/transformers": "^3.6.3",
2828
"@iconify-json/carbon": "^1.2.8",
2929
"@iconify-json/lucide": "^1.2.45",
3030
"@iconify-json/material-symbols": "^1.2.15",
@@ -51,7 +51,7 @@
5151
"highlight.js": "^11.10.0",
5252
"jiti": "^2.4.2",
5353
"jsdom": "^26.0.0",
54-
"melt": "^0.30.1",
54+
"melt": "^0.36.0",
5555
"openai": "^4.90.0",
5656
"playwright": "^1.52.0",
5757
"postcss": "^8.4.38",
@@ -60,7 +60,7 @@
6060
"prettier-plugin-tailwindcss": "^0.6.11",
6161
"runed": "^0.25.0",
6262
"shiki": "^3.4.0",
63-
"svelte": "^5.35.1",
63+
"svelte": "^5.36.16",
6464
"svelte-check": "^4.0.0",
6565
"tailwind-merge": "^3.0.2",
6666
"tailwindcss": "^4.0.9",
@@ -77,8 +77,10 @@
7777
"dependencies": {
7878
"@modelcontextprotocol/sdk": "^1.13.3",
7979
"@sentry/sveltekit": "^9.34.0",
80+
"@tailwindcss/typography": "^0.5.16",
8081
"dequal": "^2.0.3",
81-
"eslint-plugin-svelte": "^3.6.0",
82+
"eslint-plugin-svelte": "^3.11.0",
83+
"marked": "^16.1.2",
8284
"remult": "^3.0.2",
8385
"tailwindcss-spring": "^1.0.1",
8486
"typia": "^8.0.0"

0 commit comments

Comments
 (0)