mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-08-04 12:44:33 +08:00
chore
This commit is contained in:
@@ -3,10 +3,10 @@ import { cropText } from '../../../utils'
|
||||
export default {
|
||||
inputQuery: async () => {
|
||||
try {
|
||||
const title = document.querySelector('[id*="post-title"]').textContent
|
||||
const title = document.querySelector('[id*="post-title"]')?.textContent
|
||||
const description = document.querySelector(
|
||||
'shreddit-post > div.text-neutral-content',
|
||||
).textContent
|
||||
)?.textContent
|
||||
const texts = document.querySelectorAll('shreddit-comment div.md')
|
||||
let answers = ''
|
||||
for (let i = 0; i < texts.length; i++) {
|
||||
|
||||
@@ -35,7 +35,7 @@ export async function cropText(
|
||||
tiktoken = true,
|
||||
) {
|
||||
const userConfig = await getUserConfig()
|
||||
const k = Models[userConfig.modelName].desc.match(/[- ]*([0-9]+)k/)?.[1]
|
||||
const k = Models[userConfig.modelName].desc.match(/[- (]*([0-9]+)k/)?.[1]
|
||||
if (k) {
|
||||
maxLength = Number(k) * 1000
|
||||
maxLength -= 100 + clamp(userConfig.maxResponseTokenLength, 1, maxLength - 1000)
|
||||
|
||||
Reference in New Issue
Block a user