@chat-js/cli 0.2.0 → 0.2.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/dist/index.js +4 -4
- package/package.json +48 -48
- package/templates/chat-app/app/(chat)/actions.ts +17 -13
- package/templates/chat-app/app/globals.css +1 -1
- package/templates/chat-app/chat.config.ts +2 -2
- package/templates/chat-app/lib/ai/followup-suggestions.ts +4 -1
- package/templates/chat-app/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3914,17 +3914,17 @@ var {
|
|
|
3914
3914
|
// package.json
|
|
3915
3915
|
var package_default = {
|
|
3916
3916
|
name: "@chat-js/cli",
|
|
3917
|
-
version: "0.2.
|
|
3917
|
+
version: "0.2.1",
|
|
3918
3918
|
description: "CLI for creating and extending ChatJS apps",
|
|
3919
3919
|
license: "Apache-2.0",
|
|
3920
3920
|
repository: {
|
|
3921
3921
|
type: "git",
|
|
3922
|
-
url: "https://github.com/franciscomoretti/chat
|
|
3922
|
+
url: "https://github.com/franciscomoretti/chat-js.git",
|
|
3923
3923
|
directory: "packages/cli"
|
|
3924
3924
|
},
|
|
3925
|
-
homepage: "https://github.com/franciscomoretti/chat
|
|
3925
|
+
homepage: "https://github.com/franciscomoretti/chat-js/tree/main/packages/cli",
|
|
3926
3926
|
bugs: {
|
|
3927
|
-
url: "https://github.com/franciscomoretti/chat
|
|
3927
|
+
url: "https://github.com/franciscomoretti/chat-js/issues"
|
|
3928
3928
|
},
|
|
3929
3929
|
keywords: [
|
|
3930
3930
|
"chatjs",
|
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
2
|
+
"name": "@chat-js/cli",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "CLI for creating and extending ChatJS apps",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/franciscomoretti/chat-js.git",
|
|
9
|
+
"directory": "packages/cli"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/franciscomoretti/chat-js/tree/main/packages/cli",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/franciscomoretti/chat-js/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"chatjs",
|
|
17
|
+
"ai",
|
|
18
|
+
"cli",
|
|
19
|
+
"scaffold",
|
|
20
|
+
"nextjs"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@clack/prompts": "^1.0.1",
|
|
24
|
+
"commander": "^14.0.0",
|
|
25
|
+
"kleur": "^4.1.5",
|
|
26
|
+
"ora": "^8.2.0",
|
|
27
|
+
"zod": "^4.3.6"
|
|
28
|
+
},
|
|
29
|
+
"bin": {
|
|
30
|
+
"chat-js": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"templates"
|
|
35
|
+
],
|
|
36
|
+
"private": false,
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"start": "bun src/index.ts",
|
|
42
|
+
"build": "bun build ./src/index.ts --target=node --format=esm --outfile ./dist/index.js",
|
|
43
|
+
"template:sync": "bun ../../scripts/sync-template.ts",
|
|
44
|
+
"prepublishOnly": "bun run template:sync && bun run build && node ./dist/index.js --help >/dev/null"
|
|
45
|
+
},
|
|
46
|
+
"type": "module",
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/bun": "latest"
|
|
49
|
+
}
|
|
50
50
|
}
|
|
@@ -6,20 +6,24 @@ import type { ChatMessage } from "@/lib/ai/types";
|
|
|
6
6
|
import { config } from "@/lib/config";
|
|
7
7
|
|
|
8
8
|
export async function generateTitleFromUserMessage({
|
|
9
|
-
|
|
9
|
+
message,
|
|
10
10
|
}: {
|
|
11
|
-
|
|
11
|
+
message: ChatMessage;
|
|
12
12
|
}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- you will generate a short title based on the first message a user begins a conversation with
|
|
17
|
-
- ensure it is not more than 40 characters long
|
|
18
|
-
- the title should be a summary of the user's message
|
|
19
|
-
- do not use quotes or colons`,
|
|
20
|
-
prompt: JSON.stringify(message),
|
|
21
|
-
experimental_telemetry: { isEnabled: true },
|
|
22
|
-
});
|
|
13
|
+
const { text: title } = await generateText({
|
|
14
|
+
model: await getLanguageModel(config.ai.workflows.title),
|
|
15
|
+
system: `Generate a concise title for a chat conversation based on the user's first message.
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
Rules (strictly follow all):
|
|
18
|
+
- Maximum 40 characters — hard limit, never exceed this
|
|
19
|
+
- 3-6 words is ideal
|
|
20
|
+
- No quotes, colons, or punctuation at the end
|
|
21
|
+
- No filler words like "How to" or "Question about"
|
|
22
|
+
- Use title case
|
|
23
|
+
- Return ONLY the title, nothing else`,
|
|
24
|
+
prompt: JSON.stringify(message),
|
|
25
|
+
experimental_telemetry: { isEnabled: true },
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return title;
|
|
25
29
|
}
|
|
@@ -95,7 +95,7 @@ const config = {
|
|
|
95
95
|
],
|
|
96
96
|
workflows: {
|
|
97
97
|
chat: "openai/gpt-5-mini",
|
|
98
|
-
title: "
|
|
98
|
+
title: "google/gemini-2.5-flash-lite",
|
|
99
99
|
pdf: "openai/gpt-5-mini",
|
|
100
100
|
chatImageCompatible: "openai/gpt-4o-mini",
|
|
101
101
|
},
|
|
@@ -114,7 +114,7 @@ const config = {
|
|
|
114
114
|
},
|
|
115
115
|
followupSuggestions: {
|
|
116
116
|
enabled: true,
|
|
117
|
-
default: "
|
|
117
|
+
default: "google/gemini-2.5-flash-lite",
|
|
118
118
|
},
|
|
119
119
|
text: {
|
|
120
120
|
polish: "openai/gpt-5-mini",
|
|
@@ -5,16 +5,19 @@ import type { StreamWriter } from "@/lib/ai/types";
|
|
|
5
5
|
import { config } from "@/lib/config";
|
|
6
6
|
import { generateUUID } from "@/lib/utils";
|
|
7
7
|
|
|
8
|
+
const FOLLOWUP_CONTEXT_MESSAGES = 2;
|
|
9
|
+
|
|
8
10
|
export async function generateFollowupSuggestions(
|
|
9
11
|
modelMessages: ModelMessage[]
|
|
10
12
|
) {
|
|
11
13
|
const maxQuestionCount = 5;
|
|
12
14
|
const minQuestionCount = 3;
|
|
13
15
|
const maxCharactersPerQuestion = 80;
|
|
16
|
+
const recentMessages = modelMessages.slice(-FOLLOWUP_CONTEXT_MESSAGES);
|
|
14
17
|
return streamText({
|
|
15
18
|
model: await getLanguageModel(config.ai.tools.followupSuggestions.default),
|
|
16
19
|
messages: [
|
|
17
|
-
...
|
|
20
|
+
...recentMessages,
|
|
18
21
|
{
|
|
19
22
|
role: "user",
|
|
20
23
|
content: `What question should I ask next? Return an array of suggested questions (minimum ${minQuestionCount}, maximum ${maxQuestionCount}). Each question should be no more than ${maxCharactersPerQuestion} characters.`,
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@radix-ui/react-toggle": "^1.1.10",
|
|
89
89
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
90
90
|
"@radix-ui/react-use-controllable-state": "^1.2.2",
|
|
91
|
-
"@streamdown/code": "^1.0.
|
|
91
|
+
"@streamdown/code": "^1.0.3",
|
|
92
92
|
"@streamdown/math": "^1.0.2",
|
|
93
93
|
"@streamdown/mermaid": "^1.0.2",
|
|
94
94
|
"@t3-oss/env-nextjs": "^0.13.8",
|