feat: change token get
This commit is contained in:
parent
70d1f40333
commit
c5fa739a95
@ -6,10 +6,10 @@ import { formatDate } from "@/utils/date"
|
||||
|
||||
const columns: TableProps<MeteringEntry>["columns"] = [
|
||||
{
|
||||
title: "id",
|
||||
dataIndex: "id",
|
||||
key: "id",
|
||||
width: "13%"
|
||||
title: '序号',
|
||||
key: 'index',
|
||||
width: 100,
|
||||
render: (_text, _record, index) => index + 1, // 索引从0开始,+1后从1显示
|
||||
},
|
||||
{
|
||||
title: "问题",
|
||||
@ -84,7 +84,7 @@ const columns: TableProps<MeteringEntry>["columns"] = [
|
||||
dataIndex: "date",
|
||||
key: "date",
|
||||
render: (date) => {
|
||||
return <div>{formatDate(date)}</div>
|
||||
return <div>{formatDate(date ?? new Date())}</div>
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -193,7 +193,8 @@ export const useMessageOption = () => {
|
||||
let generateMessageId = generateID()
|
||||
const meter: MeteringEntry = {
|
||||
id: generateMessageId,
|
||||
queryContent: message
|
||||
queryContent: message,
|
||||
date: new Date()
|
||||
} as MeteringEntry
|
||||
|
||||
if (!isRegenerate) {
|
||||
@ -488,18 +489,20 @@ export const useMessageOption = () => {
|
||||
|
||||
// Save metering entry
|
||||
const { cot, content } = responseResolver(fullText)
|
||||
setMeteringEntries([...meteringEntries, {
|
||||
setMeteringEntries([ {
|
||||
...meter,
|
||||
modelInputTokenCount: generationInfo?.prompt_eval_count ?? 0,
|
||||
modelOutputTokenCount: generationInfo?.eval_count ?? 0,
|
||||
model: generationInfo?.model ?? "",
|
||||
modelInputTokenCount: prompt.length,
|
||||
modelOutputTokenCount: fullText.length,
|
||||
model: ollama.modelName,
|
||||
relatedDataCount: iodData?.length ?? 0,
|
||||
timeTaken: timetaken,
|
||||
timeTaken: new Date().getTime() - meter.date.getTime(),
|
||||
date: chatStartTime,
|
||||
cot,
|
||||
responseContent: content,
|
||||
modelResponseContent: fullText,
|
||||
}])
|
||||
},
|
||||
...meteringEntries,
|
||||
])
|
||||
} catch (e) {
|
||||
const errorSave = await saveMessageOnError({
|
||||
e,
|
||||
|
@ -72,7 +72,7 @@ export const pageAssistModel = async ({
|
||||
configuration: {
|
||||
apiKey: providerInfo.apiKey || "temp",
|
||||
baseURL: providerInfo.baseUrl || ""
|
||||
}
|
||||
},
|
||||
}) as any
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ export const pageAssistModel = async ({
|
||||
configuration: {
|
||||
apiKey: providerInfo.apiKey || "temp",
|
||||
baseURL: providerInfo.baseUrl || ""
|
||||
}
|
||||
},
|
||||
}) as any
|
||||
}
|
||||
return new ChatOllama({
|
||||
|
Loading…
x
Reference in New Issue
Block a user