@unikode/cli 1.0.19 → 1.0.21
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 +69 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1006,6 +1006,24 @@ var STATIC_CHAT_MODELS = [
|
|
|
1006
1006
|
outputUsdPerMillionTokens: 2
|
|
1007
1007
|
},
|
|
1008
1008
|
tools: true
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
id: "gpt-oss:20b-cloud",
|
|
1012
|
+
provider: "local-ollama",
|
|
1013
|
+
pricing: {
|
|
1014
|
+
inputUsdPerMillionTokens: 30,
|
|
1015
|
+
outputUsdPerMillionTokens: 30
|
|
1016
|
+
},
|
|
1017
|
+
tools: true
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
id: "gpt-oss:120b-cloud",
|
|
1021
|
+
provider: "local-ollama",
|
|
1022
|
+
pricing: {
|
|
1023
|
+
inputUsdPerMillionTokens: 30,
|
|
1024
|
+
outputUsdPerMillionTokens: 30
|
|
1025
|
+
},
|
|
1026
|
+
tools: true
|
|
1009
1027
|
}
|
|
1010
1028
|
];
|
|
1011
1029
|
var SUPPORTED_CHAT_MODELS = [...STATIC_CHAT_MODELS];
|
|
@@ -3060,9 +3078,11 @@ function SessionShell({
|
|
|
3060
3078
|
onSubmit,
|
|
3061
3079
|
inputDisabled = false,
|
|
3062
3080
|
loading = false,
|
|
3063
|
-
interruptible = false
|
|
3081
|
+
interruptible = false,
|
|
3082
|
+
tokenCount
|
|
3064
3083
|
}) {
|
|
3065
3084
|
const { mode } = usePromptConfig();
|
|
3085
|
+
const { colors } = useTheme();
|
|
3066
3086
|
return /* @__PURE__ */ jsxDEV21("box", {
|
|
3067
3087
|
flexDirection: "column",
|
|
3068
3088
|
flexGrow: 1,
|
|
@@ -3081,6 +3101,37 @@ function SessionShell({
|
|
|
3081
3101
|
children
|
|
3082
3102
|
}, undefined, false, undefined, this)
|
|
3083
3103
|
}, undefined, false, undefined, this),
|
|
3104
|
+
tokenCount !== undefined && /* @__PURE__ */ jsxDEV21("box", {
|
|
3105
|
+
flexShrink: 0,
|
|
3106
|
+
flexDirection: "row",
|
|
3107
|
+
justifyContent: "flex-end",
|
|
3108
|
+
alignItems: "center",
|
|
3109
|
+
width: "100%",
|
|
3110
|
+
paddingX: 1,
|
|
3111
|
+
children: /* @__PURE__ */ jsxDEV21("box", {
|
|
3112
|
+
flexDirection: "row",
|
|
3113
|
+
alignItems: "center",
|
|
3114
|
+
gap: 1,
|
|
3115
|
+
paddingX: 1,
|
|
3116
|
+
backgroundColor: colors.surface,
|
|
3117
|
+
children: [
|
|
3118
|
+
/* @__PURE__ */ jsxDEV21("text", {
|
|
3119
|
+
fg: mode === Mode.PLAN ? colors.planMode : colors.primary,
|
|
3120
|
+
children: "\u26A1"
|
|
3121
|
+
}, undefined, false, undefined, this),
|
|
3122
|
+
/* @__PURE__ */ jsxDEV21("text", {
|
|
3123
|
+
attributes: TextAttributes8.DIM,
|
|
3124
|
+
fg: colors.info,
|
|
3125
|
+
children: "Tokens:"
|
|
3126
|
+
}, undefined, false, undefined, this),
|
|
3127
|
+
/* @__PURE__ */ jsxDEV21("text", {
|
|
3128
|
+
fg: mode === Mode.PLAN ? colors.planMode : colors.primary,
|
|
3129
|
+
attributes: TextAttributes8.BOLD,
|
|
3130
|
+
children: tokenCount.toLocaleString()
|
|
3131
|
+
}, undefined, false, undefined, this)
|
|
3132
|
+
]
|
|
3133
|
+
}, undefined, true, undefined, this)
|
|
3134
|
+
}, undefined, false, undefined, this),
|
|
3084
3135
|
/* @__PURE__ */ jsxDEV21("box", {
|
|
3085
3136
|
flexShrink: 0,
|
|
3086
3137
|
children: /* @__PURE__ */ jsxDEV21(InputBar, {
|
|
@@ -4388,7 +4439,24 @@ function SessionChat({ session, initialPrompt }) {
|
|
|
4388
4439
|
model: initialPrompt.model
|
|
4389
4440
|
});
|
|
4390
4441
|
}, [initialPrompt, submit]);
|
|
4442
|
+
const totalTokenCount = useMemo6(() => {
|
|
4443
|
+
let initialUsageSum = 0;
|
|
4444
|
+
let currentUsageSum = 0;
|
|
4445
|
+
for (let i = 0;i < messages.length; i++) {
|
|
4446
|
+
const msg = messages[i];
|
|
4447
|
+
const metadata = msg?.metadata;
|
|
4448
|
+
const tokens = metadata?.usage?.totalTokens ?? 0;
|
|
4449
|
+
currentUsageSum += tokens;
|
|
4450
|
+
if (i < initialMessages.length) {
|
|
4451
|
+
initialUsageSum += tokens;
|
|
4452
|
+
}
|
|
4453
|
+
}
|
|
4454
|
+
const baseTokens = Math.max(session.tokenCount ?? 0, initialUsageSum);
|
|
4455
|
+
const newTokens = currentUsageSum - initialUsageSum;
|
|
4456
|
+
return baseTokens + newTokens;
|
|
4457
|
+
}, [messages, initialMessages.length, session.tokenCount]);
|
|
4391
4458
|
return /* @__PURE__ */ jsxDEV28(SessionShell, {
|
|
4459
|
+
tokenCount: totalTokenCount,
|
|
4392
4460
|
onSubmit: (text) => {
|
|
4393
4461
|
deactivateQuestionPrompts();
|
|
4394
4462
|
submit({ userText: text, mode, model });
|