codeblog-app 1.5.2 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/src/ai/chat.ts +104 -40
- package/src/ai/configure.ts +89 -0
- package/src/ai/provider.ts +117 -14
- package/src/ai/tools.ts +556 -0
- package/src/auth/oauth.ts +22 -6
- package/src/scanner/cursor.ts +8 -2
- package/src/tui/app.tsx +57 -50
- package/src/tui/commands.ts +166 -0
- package/src/tui/context/route.tsx +2 -2
- package/src/tui/context/theme.tsx +1 -1
- package/src/tui/routes/home.tsx +383 -240
- package/src/tui/routes/model.tsx +209 -0
- package/src/tui/routes/chat.tsx +0 -210
package/src/tui/app.tsx
CHANGED
|
@@ -4,8 +4,8 @@ import { RouteProvider, useRoute } from "./context/route"
|
|
|
4
4
|
import { ExitProvider, useExit } from "./context/exit"
|
|
5
5
|
import { ThemeProvider, useTheme } from "./context/theme"
|
|
6
6
|
import { Home } from "./routes/home"
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { ThemePicker } from "./routes/setup"
|
|
8
|
+
import { ModelPicker } from "./routes/model"
|
|
9
9
|
|
|
10
10
|
import pkg from "../../package.json"
|
|
11
11
|
const VERSION = pkg.version
|
|
@@ -42,6 +42,23 @@ function App() {
|
|
|
42
42
|
const [username, setUsername] = createSignal("")
|
|
43
43
|
const [hasAI, setHasAI] = createSignal(false)
|
|
44
44
|
const [aiProvider, setAiProvider] = createSignal("")
|
|
45
|
+
const [modelName, setModelName] = createSignal("")
|
|
46
|
+
|
|
47
|
+
async function refreshAI() {
|
|
48
|
+
try {
|
|
49
|
+
const { AIProvider } = await import("../ai/provider")
|
|
50
|
+
const has = await AIProvider.hasAnyKey()
|
|
51
|
+
setHasAI(has)
|
|
52
|
+
if (has) {
|
|
53
|
+
const { Config } = await import("../config")
|
|
54
|
+
const cfg = await Config.load()
|
|
55
|
+
const model = cfg.model || AIProvider.DEFAULT_MODEL
|
|
56
|
+
setModelName(model)
|
|
57
|
+
const info = AIProvider.BUILTIN_MODELS[model]
|
|
58
|
+
setAiProvider(info?.providerID || model.split("/")[0] || "ai")
|
|
59
|
+
}
|
|
60
|
+
} catch {}
|
|
61
|
+
}
|
|
45
62
|
|
|
46
63
|
onMount(async () => {
|
|
47
64
|
renderer.setTerminalTitle("CodeBlog")
|
|
@@ -52,24 +69,12 @@ function App() {
|
|
|
52
69
|
const authenticated = await Auth.authenticated()
|
|
53
70
|
setLoggedIn(authenticated)
|
|
54
71
|
if (authenticated) {
|
|
55
|
-
const token = await Auth.
|
|
72
|
+
const token = await Auth.get()
|
|
56
73
|
if (token?.username) setUsername(token.username)
|
|
57
74
|
}
|
|
58
75
|
} catch {}
|
|
59
76
|
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
const { AIProvider } = await import("../ai/provider")
|
|
63
|
-
const has = await AIProvider.hasAnyKey()
|
|
64
|
-
setHasAI(has)
|
|
65
|
-
if (has) {
|
|
66
|
-
const { Config } = await import("../config")
|
|
67
|
-
const cfg = await Config.load()
|
|
68
|
-
const model = cfg.model || AIProvider.DEFAULT_MODEL
|
|
69
|
-
const info = AIProvider.BUILTIN_MODELS[model]
|
|
70
|
-
setAiProvider(info?.name || model)
|
|
71
|
-
}
|
|
72
|
-
} catch {}
|
|
77
|
+
await refreshAI()
|
|
73
78
|
})
|
|
74
79
|
|
|
75
80
|
useKeyboard((evt) => {
|
|
@@ -79,16 +84,7 @@ function App() {
|
|
|
79
84
|
return
|
|
80
85
|
}
|
|
81
86
|
|
|
82
|
-
//
|
|
83
|
-
if (route.data.type === "home") {
|
|
84
|
-
if (evt.name === "q" && !evt.ctrl) {
|
|
85
|
-
exit()
|
|
86
|
-
evt.preventDefault()
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Back navigation
|
|
87
|
+
// Back navigation from sub-pages
|
|
92
88
|
if (evt.name === "escape" && route.data.type !== "home") {
|
|
93
89
|
route.navigate({ type: "home" })
|
|
94
90
|
evt.preventDefault()
|
|
@@ -99,57 +95,68 @@ function App() {
|
|
|
99
95
|
return (
|
|
100
96
|
<box flexDirection="column" width={dimensions().width} height={dimensions().height}>
|
|
101
97
|
<Switch>
|
|
102
|
-
<Match when={theme.needsSetup}>
|
|
103
|
-
<ThemeSetup />
|
|
104
|
-
</Match>
|
|
105
98
|
<Match when={route.data.type === "home"}>
|
|
106
99
|
<Home
|
|
107
100
|
loggedIn={loggedIn()}
|
|
108
101
|
username={username()}
|
|
109
102
|
hasAI={hasAI()}
|
|
110
103
|
aiProvider={aiProvider()}
|
|
104
|
+
modelName={modelName()}
|
|
111
105
|
onLogin={async () => {
|
|
112
106
|
try {
|
|
113
107
|
const { OAuth } = await import("../auth/oauth")
|
|
114
108
|
await OAuth.login("github")
|
|
115
109
|
const { Auth } = await import("../auth")
|
|
116
110
|
setLoggedIn(true)
|
|
117
|
-
const token = await Auth.
|
|
111
|
+
const token = await Auth.get()
|
|
118
112
|
if (token?.username) setUsername(token.username)
|
|
119
113
|
} catch {}
|
|
120
114
|
}}
|
|
115
|
+
onLogout={() => { setLoggedIn(false); setUsername("") }}
|
|
116
|
+
onAIConfigured={refreshAI}
|
|
121
117
|
/>
|
|
122
118
|
</Match>
|
|
123
|
-
<Match when={route.data.type === "chat"}>
|
|
124
|
-
<Chat />
|
|
125
|
-
</Match>
|
|
126
119
|
<Match when={route.data.type === "theme"}>
|
|
127
120
|
<ThemePicker onDone={() => route.navigate({ type: "home" })} />
|
|
128
121
|
</Match>
|
|
122
|
+
<Match when={route.data.type === "model"}>
|
|
123
|
+
<ModelPicker onDone={async (model) => {
|
|
124
|
+
if (model) setModelName(model)
|
|
125
|
+
await refreshAI()
|
|
126
|
+
route.navigate({ type: "home" })
|
|
127
|
+
}} />
|
|
128
|
+
</Match>
|
|
129
129
|
</Switch>
|
|
130
130
|
|
|
131
|
-
{/* Status bar */}
|
|
132
|
-
<box paddingLeft={2} paddingRight={2}
|
|
133
|
-
<text fg={theme.colors.textMuted}>
|
|
134
|
-
{route.data.type === "home"
|
|
135
|
-
? "type to chat · /help · /theme · q:quit"
|
|
136
|
-
: "esc:back · ctrl+c:exit"}
|
|
137
|
-
</text>
|
|
131
|
+
{/* Status bar — like OpenCode */}
|
|
132
|
+
<box paddingLeft={2} paddingRight={2} flexShrink={0} flexDirection="row" gap={2}>
|
|
133
|
+
<text fg={theme.colors.textMuted}>{process.cwd()}</text>
|
|
138
134
|
<box flexGrow={1} />
|
|
139
135
|
<Show when={hasAI()}>
|
|
140
|
-
<text fg={theme.colors.
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
<text fg={theme.colors.text}>
|
|
137
|
+
<span style={{ fg: theme.colors.success }}>● </span>
|
|
138
|
+
{modelName()}
|
|
139
|
+
</text>
|
|
143
140
|
</Show>
|
|
144
141
|
<Show when={!hasAI()}>
|
|
145
|
-
<text fg={theme.colors.
|
|
146
|
-
|
|
142
|
+
<text fg={theme.colors.text}>
|
|
143
|
+
<span style={{ fg: theme.colors.error }}>○ </span>
|
|
144
|
+
no AI <span style={{ fg: theme.colors.textMuted }}>/ai</span>
|
|
145
|
+
</text>
|
|
146
|
+
</Show>
|
|
147
|
+
<Show when={loggedIn()}>
|
|
148
|
+
<text fg={theme.colors.text}>
|
|
149
|
+
<span style={{ fg: theme.colors.success }}>● </span>
|
|
150
|
+
{username() || "logged in"}
|
|
151
|
+
</text>
|
|
152
|
+
</Show>
|
|
153
|
+
<Show when={!loggedIn()}>
|
|
154
|
+
<text fg={theme.colors.text}>
|
|
155
|
+
<span style={{ fg: theme.colors.error }}>○ </span>
|
|
156
|
+
<span style={{ fg: theme.colors.textMuted }}>/login</span>
|
|
157
|
+
</text>
|
|
147
158
|
</Show>
|
|
148
|
-
<text fg={
|
|
149
|
-
{loggedIn() ? "● " : "○ "}
|
|
150
|
-
</text>
|
|
151
|
-
<text fg={theme.colors.textMuted}>{loggedIn() ? username() || "logged in" : "not logged in"}</text>
|
|
152
|
-
<text fg={theme.colors.textMuted}>{` v${VERSION}`}</text>
|
|
159
|
+
<text fg={theme.colors.textMuted}>v{VERSION}</text>
|
|
153
160
|
</box>
|
|
154
161
|
</box>
|
|
155
162
|
)
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// Slash command definitions for the TUI home screen
|
|
2
|
+
|
|
3
|
+
export interface CmdDef {
|
|
4
|
+
name: string
|
|
5
|
+
description: string
|
|
6
|
+
action: (parts: string[]) => void | Promise<void>
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CommandDeps {
|
|
10
|
+
showMsg: (text: string, color?: string) => void
|
|
11
|
+
navigate: (route: any) => void
|
|
12
|
+
exit: () => void
|
|
13
|
+
onLogin: () => Promise<void>
|
|
14
|
+
onLogout: () => void
|
|
15
|
+
clearChat: () => void
|
|
16
|
+
startAIConfig: () => void
|
|
17
|
+
setMode: (mode: "dark" | "light") => void
|
|
18
|
+
send: (prompt: string) => void
|
|
19
|
+
colors: {
|
|
20
|
+
primary: string
|
|
21
|
+
success: string
|
|
22
|
+
warning: string
|
|
23
|
+
error: string
|
|
24
|
+
text: string
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function createCommands(deps: CommandDeps): CmdDef[] {
|
|
29
|
+
return [
|
|
30
|
+
// UI-only commands (no AI needed)
|
|
31
|
+
{ name: "/ai", description: "Configure AI provider (paste URL + key)", action: () => deps.startAIConfig() },
|
|
32
|
+
{ name: "/model", description: "Choose AI model", action: () => deps.navigate({ type: "model" }) },
|
|
33
|
+
{ name: "/clear", description: "Clear conversation", action: () => deps.clearChat() },
|
|
34
|
+
{ name: "/new", description: "New conversation", action: () => deps.clearChat() },
|
|
35
|
+
{ name: "/login", description: "Sign in to CodeBlog", action: async () => {
|
|
36
|
+
deps.showMsg("Opening browser for login...", deps.colors.primary)
|
|
37
|
+
await deps.onLogin()
|
|
38
|
+
deps.showMsg("Logged in!", deps.colors.success)
|
|
39
|
+
}},
|
|
40
|
+
{ name: "/logout", description: "Sign out of CodeBlog", action: async () => {
|
|
41
|
+
try {
|
|
42
|
+
const { Auth } = await import("../auth")
|
|
43
|
+
await Auth.remove()
|
|
44
|
+
deps.showMsg("Logged out.", deps.colors.text)
|
|
45
|
+
deps.onLogout()
|
|
46
|
+
} catch (err) { deps.showMsg(`Logout failed: ${err instanceof Error ? err.message : String(err)}`, deps.colors.error) }
|
|
47
|
+
}},
|
|
48
|
+
{ name: "/theme", description: "Change color theme", action: () => deps.navigate({ type: "theme" }) },
|
|
49
|
+
{ name: "/dark", description: "Switch to dark mode", action: () => { deps.setMode("dark"); deps.showMsg("Dark mode", deps.colors.text) } },
|
|
50
|
+
{ name: "/light", description: "Switch to light mode", action: () => { deps.setMode("light"); deps.showMsg("Light mode", deps.colors.text) } },
|
|
51
|
+
{ name: "/exit", description: "Exit CodeBlog", action: () => deps.exit() },
|
|
52
|
+
|
|
53
|
+
// === Session tools (scan_sessions, read_session, analyze_session) ===
|
|
54
|
+
{ name: "/scan", description: "Scan IDE coding sessions", action: () => deps.send("Scan my local IDE coding sessions and tell me what you found. Show sources, projects, and session counts.") },
|
|
55
|
+
{ name: "/read", description: "Read a session: /read <index>", action: (parts) => {
|
|
56
|
+
const idx = parts[1]
|
|
57
|
+
deps.send(idx ? `Read session #${idx} from my scan results and show me the conversation.` : "Scan my sessions and read the most recent one in full.")
|
|
58
|
+
}},
|
|
59
|
+
{ name: "/analyze", description: "Analyze a session: /analyze <index>", action: (parts) => {
|
|
60
|
+
const idx = parts[1]
|
|
61
|
+
deps.send(idx ? `Analyze session #${idx} — extract topics, problems, solutions, code snippets, and insights.` : "Scan my sessions and analyze the most interesting one.")
|
|
62
|
+
}},
|
|
63
|
+
|
|
64
|
+
// === Posting tools (post_to_codeblog, auto_post, weekly_digest) ===
|
|
65
|
+
{ name: "/publish", description: "Auto-publish a coding session", action: () => deps.send("Scan my IDE sessions, pick the most interesting one with enough content, and auto-publish it as a blog post on CodeBlog.") },
|
|
66
|
+
{ name: "/write", description: "Write a custom post: /write <title>", action: (parts) => {
|
|
67
|
+
const title = parts.slice(1).join(" ")
|
|
68
|
+
deps.send(title ? `Write and publish a blog post titled "${title}" on CodeBlog.` : "Help me write a blog post for CodeBlog. Ask me what I want to write about.")
|
|
69
|
+
}},
|
|
70
|
+
{ name: "/digest", description: "Weekly coding digest", action: () => deps.send("Generate a weekly coding digest from my recent sessions — aggregate projects, languages, problems, and insights. Preview it first.") },
|
|
71
|
+
|
|
72
|
+
// === Forum browse & search (browse_posts, search_posts, read_post, browse_by_tag, trending_topics, explore_and_engage) ===
|
|
73
|
+
{ name: "/feed", description: "Browse recent posts", action: () => deps.send("Browse the latest posts on CodeBlog. Show me titles, authors, votes, tags, and a brief summary of each.") },
|
|
74
|
+
{ name: "/search", description: "Search posts: /search <query>", action: (parts) => {
|
|
75
|
+
const query = parts.slice(1).join(" ")
|
|
76
|
+
if (!query) { deps.showMsg("Usage: /search <query>", deps.colors.warning); return }
|
|
77
|
+
deps.send(`Search CodeBlog for "${query}" and show me the results with titles, summaries, and stats.`)
|
|
78
|
+
}},
|
|
79
|
+
{ name: "/post", description: "Read a post: /post <id>", action: (parts) => {
|
|
80
|
+
const id = parts[1]
|
|
81
|
+
deps.send(id ? `Read post "${id}" in full — show me the content, comments, and discussion.` : "Show me the latest posts and let me pick one to read.")
|
|
82
|
+
}},
|
|
83
|
+
{ name: "/tag", description: "Browse by tag: /tag <name>", action: (parts) => {
|
|
84
|
+
const tag = parts[1]
|
|
85
|
+
deps.send(tag ? `Show me all posts tagged "${tag}" on CodeBlog.` : "Show me the trending tags on CodeBlog.")
|
|
86
|
+
}},
|
|
87
|
+
{ name: "/trending", description: "Trending topics", action: () => deps.send("Show me trending topics on CodeBlog — top upvoted, most discussed, active agents, trending tags.") },
|
|
88
|
+
{ name: "/explore", description: "Explore & engage", action: () => deps.send("Explore the CodeBlog community — find interesting posts, trending topics, and active discussions I can engage with.") },
|
|
89
|
+
|
|
90
|
+
// === Forum interact (comment_on_post, vote_on_post, edit_post, delete_post, bookmark_post) ===
|
|
91
|
+
{ name: "/comment", description: "Comment: /comment <post_id> <text>", action: (parts) => {
|
|
92
|
+
const id = parts[1]
|
|
93
|
+
const text = parts.slice(2).join(" ")
|
|
94
|
+
if (!id) { deps.showMsg("Usage: /comment <post_id> <text>", deps.colors.warning); return }
|
|
95
|
+
deps.send(text ? `Comment on post "${id}" with: "${text}"` : `Read post "${id}" and suggest a thoughtful comment.`)
|
|
96
|
+
}},
|
|
97
|
+
{ name: "/vote", description: "Vote: /vote <post_id> [up|down]", action: (parts) => {
|
|
98
|
+
const id = parts[1]
|
|
99
|
+
const dir = parts[2] || "up"
|
|
100
|
+
if (!id) { deps.showMsg("Usage: /vote <post_id> [up|down]", deps.colors.warning); return }
|
|
101
|
+
deps.send(`${dir === "down" ? "Downvote" : "Upvote"} post "${id}".`)
|
|
102
|
+
}},
|
|
103
|
+
{ name: "/edit", description: "Edit post: /edit <post_id>", action: (parts) => {
|
|
104
|
+
const id = parts[1]
|
|
105
|
+
if (!id) { deps.showMsg("Usage: /edit <post_id>", deps.colors.warning); return }
|
|
106
|
+
deps.send(`Show me post "${id}" and help me edit it.`)
|
|
107
|
+
}},
|
|
108
|
+
{ name: "/delete", description: "Delete post: /delete <post_id>", action: (parts) => {
|
|
109
|
+
const id = parts[1]
|
|
110
|
+
if (!id) { deps.showMsg("Usage: /delete <post_id>", deps.colors.warning); return }
|
|
111
|
+
deps.send(`Delete my post "${id}". Show me the post first and ask for confirmation.`)
|
|
112
|
+
}},
|
|
113
|
+
{ name: "/bookmark", description: "Bookmark: /bookmark [post_id]", action: (parts) => {
|
|
114
|
+
const id = parts[1]
|
|
115
|
+
deps.send(id ? `Toggle bookmark on post "${id}".` : "Show me my bookmarked posts on CodeBlog.")
|
|
116
|
+
}},
|
|
117
|
+
|
|
118
|
+
// === Debates (join_debate) ===
|
|
119
|
+
{ name: "/debate", description: "Tech debates: /debate [topic]", action: (parts) => {
|
|
120
|
+
const topic = parts.slice(1).join(" ")
|
|
121
|
+
deps.send(topic ? `Create or join a debate about "${topic}" on CodeBlog.` : "Show me active tech debates on CodeBlog.")
|
|
122
|
+
}},
|
|
123
|
+
|
|
124
|
+
// === Notifications (my_notifications) ===
|
|
125
|
+
{ name: "/notifications", description: "My notifications", action: () => deps.send("Check my CodeBlog notifications and tell me what's new.") },
|
|
126
|
+
|
|
127
|
+
// === Agent tools (manage_agents, my_posts, my_dashboard, follow_user) ===
|
|
128
|
+
{ name: "/agents", description: "Manage agents", action: () => deps.send("List my CodeBlog agents and show their status.") },
|
|
129
|
+
{ name: "/posts", description: "My posts", action: () => deps.send("Show me all my posts on CodeBlog with their stats — votes, views, comments.") },
|
|
130
|
+
{ name: "/dashboard", description: "My dashboard stats", action: () => deps.send("Show me my CodeBlog dashboard — total posts, votes, views, followers, and top posts.") },
|
|
131
|
+
{ name: "/follow", description: "Follow: /follow <username>", action: (parts) => {
|
|
132
|
+
const user = parts[1]
|
|
133
|
+
deps.send(user ? `Follow user "${user}" on CodeBlog.` : "Show me who I'm following on CodeBlog.")
|
|
134
|
+
}},
|
|
135
|
+
|
|
136
|
+
// === Config & Status (show_config, codeblog_status) ===
|
|
137
|
+
{ name: "/config", description: "Show configuration", action: () => deps.send("Show my current CodeBlog configuration — AI provider, model, login status.") },
|
|
138
|
+
{ name: "/status", description: "Check setup status", action: () => deps.send("Check my CodeBlog status — login, config, detected IDEs, agent info.") },
|
|
139
|
+
|
|
140
|
+
{ name: "/help", description: "Show all commands", action: () => {
|
|
141
|
+
deps.showMsg("/scan /read /analyze /publish /write /digest /feed /search /post /tag /trending /explore /comment /vote /edit /delete /bookmark /debate /notifications /agents /posts /dashboard /follow /config /status | /ai /model /clear /theme /login /logout /exit", deps.colors.text)
|
|
142
|
+
}},
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export const TIPS = [
|
|
147
|
+
"Type /ai to configure your AI provider with a URL and API key",
|
|
148
|
+
"Type /model to switch between available AI models",
|
|
149
|
+
"Use /scan to discover IDE coding sessions from Cursor, Windsurf, etc.",
|
|
150
|
+
"Use /publish to share your coding sessions as blog posts",
|
|
151
|
+
"Type /feed to browse recent posts from the community",
|
|
152
|
+
"Type /theme to switch between color themes",
|
|
153
|
+
"Press Ctrl+C to exit at any time",
|
|
154
|
+
"Type / to see all available commands with autocomplete",
|
|
155
|
+
"Just start typing to chat with AI — no command needed!",
|
|
156
|
+
"Use /clear to reset the conversation",
|
|
157
|
+
]
|
|
158
|
+
|
|
159
|
+
export const LOGO = [
|
|
160
|
+
" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 ",
|
|
161
|
+
" \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d ",
|
|
162
|
+
" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557",
|
|
163
|
+
" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255d \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551",
|
|
164
|
+
" \u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d",
|
|
165
|
+
" \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d ",
|
|
166
|
+
]
|
|
@@ -2,15 +2,15 @@ import { createStore } from "solid-js/store"
|
|
|
2
2
|
import { createSimpleContext } from "./helper"
|
|
3
3
|
|
|
4
4
|
export type HomeRoute = { type: "home" }
|
|
5
|
-
export type ChatRoute = { type: "chat"; sessionMessages?: Array<{ role: string; content: string }> }
|
|
6
5
|
export type PostRoute = { type: "post"; postId: string }
|
|
7
6
|
export type SearchRoute = { type: "search"; query: string }
|
|
8
7
|
export type TrendingRoute = { type: "trending" }
|
|
9
8
|
export type NotificationsRoute = { type: "notifications" }
|
|
10
9
|
|
|
11
10
|
export type ThemeRoute = { type: "theme" }
|
|
11
|
+
export type ModelRoute = { type: "model" }
|
|
12
12
|
|
|
13
|
-
export type Route = HomeRoute |
|
|
13
|
+
export type Route = HomeRoute | PostRoute | SearchRoute | TrendingRoute | NotificationsRoute | ThemeRoute | ModelRoute
|
|
14
14
|
|
|
15
15
|
export const { use: useRoute, provider: RouteProvider } = createSimpleContext({
|
|
16
16
|
name: "Route",
|
|
@@ -440,7 +440,7 @@ export const { use: useTheme, provider: ThemeProvider } = createSimpleContext({
|
|
|
440
440
|
const saved = load()
|
|
441
441
|
const [store, setStore] = createStore({
|
|
442
442
|
name: saved?.name || "codeblog",
|
|
443
|
-
mode: (saved?.mode || "
|
|
443
|
+
mode: (saved?.mode || "light") as "dark" | "light",
|
|
444
444
|
needsSetup: !saved,
|
|
445
445
|
})
|
|
446
446
|
|