summaryrefslogtreecommitdiffhomepage
path: root/js/src
diff options
context:
space:
mode:
Diffstat (limited to 'js/src')
-rw-r--r--js/src/index.ts12
-rw-r--r--js/src/session/session.ts1
2 files changed, 8 insertions, 5 deletions
diff --git a/js/src/index.ts b/js/src/index.ts
index 7bd4e01b2..c9f38468b 100644
--- a/js/src/index.ts
+++ b/js/src/index.ts
@@ -33,13 +33,17 @@ cli.command("generate", "Generate OpenAPI and event specs").action(async () => {
cli
.command("run [...message]", "Run a chat message")
- .action(async (message: string[]) => {
+ .option("--session <id>", "Session ID")
+ .action(async (message: string[], options) => {
+ console.log(options);
await App.provide({ directory: process.cwd() }, async () => {
- console.log("Thinking...");
await Share.init();
- const session = await Session.create();
+ const session = options.session
+ ? await Session.get(options.session)
+ : await Session.create();
+ console.log("Session:", session.id);
console.log(
- `Share ID: ${Share.URL.replace("api.", "")}/share?id=${session.id}`,
+ `Share: ${Share.URL.replace("api.", "")}/share?id=${session.id}`,
);
Bus.subscribe(Message.Event.Updated, async (message) => {
diff --git a/js/src/session/session.ts b/js/src/session/session.ts
index 0de559dbc..b29f475c5 100644
--- a/js/src/session/session.ts
+++ b/js/src/session/session.ts
@@ -158,7 +158,6 @@ export namespace Session {
const tokens =
previous.metadata.assistant.tokens.input +
previous.metadata.assistant.tokens.output;
- console.log(tokens);
if (
tokens >
(model.info.contextWindow - (model.info.maxOutputTokens ?? 0)) * 0.9