Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
8a3e353
refactor(playground): streamline chat request state
QuentinHsu May 28, 2026
3f2107f
fix(playground): validate persisted chat state
QuentinHsu May 29, 2026
e6e86b8
refactor(playground): centralize message content access
QuentinHsu May 29, 2026
c40d00e
refactor(playground): split storage schemas
QuentinHsu May 29, 2026
bace0f0
refactor(playground): extract options loading hook
QuentinHsu May 29, 2026
97f47f2
refactor(playground): extract prompt suggestions
QuentinHsu May 29, 2026
cd52c8b
refactor(playground): extract input tools
QuentinHsu May 29, 2026
648b681
refactor(playground): extract input controls
QuentinHsu May 29, 2026
4f4ecbd
refactor(playground): extract message content display
QuentinHsu May 29, 2026
2668365
refactor(playground): extract message editor
QuentinHsu May 29, 2026
63162e5
refactor(playground): extract stream error parsing
QuentinHsu May 29, 2026
b9d969b
refactor(playground): extract request error parsing
QuentinHsu May 29, 2026
beb7804
refactor(playground): extract streaming chunk updates
QuentinHsu May 29, 2026
579e6ee
refactor(playground): extract message reasoning parser
QuentinHsu May 29, 2026
e012da4
refactor(playground): extract message streaming utilities
QuentinHsu May 29, 2026
3eea82d
refactor(playground): extract message update utilities
QuentinHsu May 29, 2026
a0dc2e3
refactor(playground): extract completion choice handling
QuentinHsu May 29, 2026
2da4cb8
refactor(playground): centralize assistant completion state
QuentinHsu May 29, 2026
a6eadbd
refactor(playground): extract stream message parsing
QuentinHsu May 29, 2026
686757b
refactor(playground): extract stream ready state checks
QuentinHsu May 29, 2026
d7014c5
refactor(playground): extract conversation message helpers
QuentinHsu May 30, 2026
8e68b3c
refactor(playground): extract state initialization helpers
QuentinHsu May 30, 2026
b43d4b9
refactor(playground): extract option fallback helpers
QuentinHsu May 30, 2026
0feb084
refactor(playground): extract message action helpers
QuentinHsu May 30, 2026
58d39d4
refactor(playground): extract input control state
QuentinHsu May 30, 2026
052e11a
refactor(playground): extract message content state
QuentinHsu May 30, 2026
af31374
refactor(playground): extract message editor state
QuentinHsu May 30, 2026
d7f819b
refactor(playground): extract message error state
QuentinHsu May 30, 2026
f266bd7
refactor(playground): extract chat render state
QuentinHsu May 30, 2026
e4968f2
refactor(playground): extract suggestion display state
QuentinHsu May 30, 2026
fe04e6e
refactor(playground): extract assistant message state checks
QuentinHsu May 30, 2026
3977cac
refactor(playground): extract input tool state
QuentinHsu May 30, 2026
6af6ea8
refactor(playground): extract stream protocol checks
QuentinHsu May 30, 2026
ab12988
refactor(playground): extract message removal helper
QuentinHsu May 30, 2026
710f6a8
refactor(playground): extract option error messages
QuentinHsu May 30, 2026
f7a4808
refactor(playground): extract input submit text helper
QuentinHsu May 30, 2026
717cdb0
refactor(playground): centralize error message checks
QuentinHsu May 30, 2026
aadfe05
refactor(playground): extract message content display checks
QuentinHsu May 30, 2026
9c18200
refactor(playground): replace raw message role checks
QuentinHsu May 30, 2026
b240be4
refactor(playground): extract non-stream response handling
QuentinHsu May 30, 2026
87eb1c5
refactor(playground): centralize stream cleanup
QuentinHsu May 30, 2026
9c8e783
refactor(playground): extract pending assistant check
QuentinHsu May 30, 2026
387aba4
perf(playground): improve mobile input controls
QuentinHsu May 30, 2026
34a0352
perf(playground): add starter empty state
QuentinHsu May 30, 2026
195a1bc
perf(playground): improve mobile message actions
QuentinHsu May 30, 2026
36c178d
perf(playground): add error recovery actions
QuentinHsu May 30, 2026
a6654f2
perf(playground): refine message editing experience
QuentinHsu May 30, 2026
46c505c
perf(playground): improve markdown code blocks
QuentinHsu May 30, 2026
fde99de
fix(playground): constrain markdown code block height
QuentinHsu May 30, 2026
fd87a9a
feat(playground): add chat history clearing
QuentinHsu May 31, 2026
49e1537
perf(playground): improve chat markdown rendering
QuentinHsu May 31, 2026
4a35414
Merge branch 'main' into perf/playground
QuentinHsu Jun 7, 2026
40af010
Merge branch 'main' into perf/playground
QuentinHsu Jun 24, 2026
4725ca6
style: format code block component
QuentinHsu Jun 24, 2026
33d38d5
style: format playground frontend files
QuentinHsu Jun 24, 2026
b5ba7d6
feat(playground): render markdown with stream parser
QuentinHsu Jun 24, 2026
a10d2e0
fix(playground): localize reasoning and chat feedback
QuentinHsu Jun 25, 2026
869258f
refactor(playground): group files by functional area
QuentinHsu Jun 25, 2026
44e5678
fix(playground): prevent history replay from freezing page
QuentinHsu Jun 25, 2026
1ad1c33
feat(playground): allow regenerating from user messages
QuentinHsu Jun 25, 2026
0b03996
feat(playground): add raw response source view
QuentinHsu Jun 25, 2026
53d7b87
feat(playground): render code with unified editor
QuentinHsu Jun 25, 2026
05cf08a
Merge remote-tracking branch 'origin/main' into perf/playground
QuentinHsu Jun 25, 2026
fcaab66
perf(playground): streamline chat input controls
QuentinHsu Jun 25, 2026
84ff6d4
fix(playground): filter models by selected group
QuentinHsu Jun 25, 2026
342650d
perf(playground): remove input suggestion chips
QuentinHsu Jun 25, 2026
dc6f248
perf(playground): stabilize reasoning trigger layout
QuentinHsu Jun 25, 2026
110a3c3
perf(playground): smooth reasoning expansion
QuentinHsu Jun 25, 2026
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
49 changes: 49 additions & 0 deletions controller/model_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ type listModelsResponse struct {
Object string `json:"object"`
}

type userModelsResponse struct {
Success bool `json:"success"`
Data []string `json:"data"`
}

func setupModelListControllerTestDB(t *testing.T) *gorm.DB {
t.Helper()

Expand Down Expand Up @@ -147,6 +152,50 @@ func pricingByModelName(pricings []model.Pricing) map[string]model.Pricing {
return byName
}

func decodeUserModelsResponse(t *testing.T, recorder *httptest.ResponseRecorder) []string {
t.Helper()

require.Equal(t, http.StatusOK, recorder.Code)
var payload userModelsResponse
require.NoError(t, common.Unmarshal(recorder.Body.Bytes(), &payload))
require.True(t, payload.Success)
return payload.Data
}

func TestGetUserModelsFiltersByRequestedGroup(t *testing.T) {
db := setupModelListControllerTestDB(t)
require.NoError(t, db.Create(&model.User{
Id: 1002,
Username: "playground-model-user",
Password: "password",
Group: "default",
Status: common.UserStatusEnabled,
}).Error)
require.NoError(t, db.Create(&[]model.Ability{
{Group: "default", Model: "zz-default-only-model", ChannelId: 1, Enabled: true},
{Group: "default", Model: "zz-disabled-model", ChannelId: 1, Enabled: false},
}).Error)

defaultRecorder := httptest.NewRecorder()
defaultContext, _ := gin.CreateTestContext(defaultRecorder)
defaultContext.Request = httptest.NewRequest(http.MethodGet, "/api/user/models?group=default", nil)
defaultContext.Set("id", 1002)

GetUserModels(defaultContext)

defaultModels := decodeUserModelsResponse(t, defaultRecorder)
require.ElementsMatch(t, []string{"zz-default-only-model"}, defaultModels)

vipRecorder := httptest.NewRecorder()
vipContext, _ := gin.CreateTestContext(vipRecorder)
vipContext.Request = httptest.NewRequest(http.MethodGet, "/api/user/models?group=vip", nil)
vipContext.Set("id", 1002)

GetUserModels(vipContext)

require.Empty(t, decodeUserModelsResponse(t, vipRecorder))
}

func TestListModelsIncludesTieredBillingModel(t *testing.T) {
withSelfUseModeDisabled(t)
withTieredBillingConfig(t, map[string]string{
Expand Down
19 changes: 19 additions & 0 deletions controller/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,25 @@ func GetUserModels(c *gin.Context) {
return
}
groups := service.GetUserUsableGroups(user.Group)
group := c.Query("group")
if group != "" {
if _, ok := groups[group]; !ok {
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",
"data": []string{},
})
return
}

c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",
"data": model.GetGroupEnabledModels(group),
})
return
}

var models []string
for group := range groups {
for _, g := range model.GetGroupEnabledModels(group) {
Expand Down
93 changes: 79 additions & 14 deletions web/bun.lock

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion web/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@
},
"dependencies": {
"@base-ui/react": "^1.5.0",
"@codemirror/lang-markdown": "^6.5.0",
"@codemirror/language": "^6.12.4",
"@codemirror/state": "^6.7.0",
"@codemirror/view": "^6.43.3",
"@fontsource-variable/lora": "^5.2.8",
"@fontsource-variable/public-sans": "^5.2.7",
"@hookform/resolvers": "^5.4.0",
"@hugeicons/core-free-icons": "^4.1.4",
"@hugeicons/react": "^1.1.6",
"@lezer/highlight": "^1.2.3",
"@lobehub/icons": "catalog:",
"@tailwindcss/postcss": "^4.3.0",
"@tanstack/react-query": "^5.100.14",
Expand Down Expand Up @@ -64,7 +69,7 @@
"shiki": "^4.1.0",
"sonner": "^2.0.7",
"sse.js": "catalog:",
"streamdown": "^2.5.0",
"stream-markdown-parser": "^1.0.7",
"tailwind-merge": "^3.6.0",
"tailwindcss": "^4.3.0",
"tokenlens": "^1.3.1",
Expand Down
7 changes: 4 additions & 3 deletions web/default/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path'
import { fileURLToPath } from 'url'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

import { defineConfig, loadEnv } from '@rsbuild/core'
import { pluginReact } from '@rsbuild/plugin-react'
import { tanstackRouter } from '@tanstack/router-plugin/rspack'
Expand All @@ -18,7 +19,7 @@ export default defineConfig(({ envMode }) => {
(['/api', '/mj', '/pg'] as const).map((key) => [
key,
{ target: serverUrl, changeOrigin: true },
]),
])
) as Record<string, { target: string; changeOrigin: boolean }>

return {
Expand Down
Loading