File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
content-script/site-adapters/reddit Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ import { cropText } from '../../../utils'
3
3
export default {
4
4
inputQuery : async ( ) => {
5
5
try {
6
- const title = document . querySelector ( '[id*="post-title"]' ) . textContent
6
+ const title = document . querySelector ( '[id*="post-title"]' ) ? .textContent
7
7
const description = document . querySelector (
8
8
'shreddit-post > div.text-neutral-content' ,
9
- ) . textContent
9
+ ) ? .textContent
10
10
const texts = document . querySelectorAll ( 'shreddit-comment div.md' )
11
11
let answers = ''
12
12
for ( let i = 0 ; i < texts . length ; i ++ ) {
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export async function cropText(
35
35
tiktoken = true ,
36
36
) {
37
37
const userConfig = await getUserConfig ( )
38
- const k = Models [ userConfig . modelName ] . desc . match ( / [ - ] * ( [ 0 - 9 ] + ) k / ) ?. [ 1 ]
38
+ const k = Models [ userConfig . modelName ] . desc . match ( / [ - ( ] * ( [ 0 - 9 ] + ) k / ) ?. [ 1 ]
39
39
if ( k ) {
40
40
maxLength = Number ( k ) * 1000
41
41
maxLength -= 100 + clamp ( userConfig . maxResponseTokenLength , 1 , maxLength - 1000 )
You can’t perform that action at this time.
0 commit comments