File tree Expand file tree Collapse file tree
content-script/site-adapters/reddit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ import { cropText } from '../../../utils'
33export default {
44 inputQuery : async ( ) => {
55 try {
6- const title = document . querySelector ( '[id*="post-title"]' ) . textContent
6+ const title = document . querySelector ( '[id*="post-title"]' ) ? .textContent
77 const description = document . querySelector (
88 'shreddit-post > div.text-neutral-content' ,
9- ) . textContent
9+ ) ? .textContent
1010 const texts = document . querySelectorAll ( 'shreddit-comment div.md' )
1111 let answers = ''
1212 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(
3535 tiktoken = true ,
3636) {
3737 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 ]
3939 if ( k ) {
4040 maxLength = Number ( k ) * 1000
4141 maxLength -= 100 + clamp ( userConfig . maxResponseTokenLength , 1 , maxLength - 1000 )
You can’t perform that action at this time.
0 commit comments