Repository: koishijs/novelai-bot
File: src/index.ts (TypeScript)

Code before:
              if (prompt[nodeId].class_type === 'KSampler') {
                prompt[nodeId].inputs.seed = parameters.seed
                prompt[nodeId].inputs.steps = parameters.steps
                prompt[nodeId].inputs.cfg = parameters.scale
                prompt[nodeId].inputs.sampler_name = options.sampler
                prompt[nodeId].inputs.denoise = options.strength ?? config.strength
                prompt[nodeId].inputs.scheduler = options.scheduler ?? config.scheduler
                const positiveNodeId = prompt[nodeId].inputs.positive[0]
                const negativeeNodeId = prompt[nodeId].inputs.negative[0]
                const latentImageNodeId = prompt[nodeId].inputs.latent_image[0]
                prompt[positiveNodeId].inputs.text = parameters.prompt
                prompt[negativeeNodeId].inputs.text = parameters.uc    
                prompt[latentImageNodeId].inputs.width = parameters.width
                prompt[latentImageNodeId].inputs.height = parameters.height
                prompt[latentImageNodeId].inputs.batch_size = parameters.n_samples
                break
              }
            }
            for (const nodeId in prompt) {
              if (prompt[nodeId].class_type === 'CheckpointLoaderSimple') {
                prompt[nodeId].inputs.ckpt_name = options.model ?? config.model
                break
              }
            }
            logger.debug('prompt:', prompt)
            return  { "prompt" : prompt }
          }
        }
      }

      const getHeaders = () => {
        switch (config.type) {
          case 'login':
          case 'token':
          case 'naifu':
            return { Authorization: `Bearer ${token}` }
          case 'stable-horde':
            return { apikey: token }
        }
      }

      let finalPrompt = prompt
      const iterate = async () => {
        const request = async () => {
          const res = await ctx.http(trimSlash(config.endpoint) + path, {
            method: 'POST',
            timeout: config.requestTimeout,
            // Since novelai's latest interface returns an application/x-zip-compressed, a responseType must be passed in
            responseType: config.type === 'naifu' ? 'text' : ['login', 'token'].includes(config.type) ? 'arraybuffer' : 'json',
            headers: {
              ...config.headers,

Review comment (suggestion):
```suggestion
            return  { prompt }
```

Code after:
            for (const nodeId in prompt) {
              if (prompt[nodeId].class_type === 'KSampler') {
                prompt[nodeId].inputs.seed = parameters.seed
                prompt[nodeId].inputs.steps = parameters.steps
                prompt[nodeId].inputs.cfg = parameters.scale
                prompt[nodeId].inputs.sampler_name = options.sampler
                prompt[nodeId].inputs.denoise = options.strength ?? config.strength
                prompt[nodeId].inputs.scheduler = options.scheduler ?? config.scheduler
                const positiveNodeId = prompt[nodeId].inputs.positive[0]
                const negativeeNodeId = prompt[nodeId].inputs.negative[0]
                const latentImageNodeId = prompt[nodeId].inputs.latent_image[0]
                prompt[positiveNodeId].inputs.text = parameters.prompt
                prompt[negativeeNodeId].inputs.text = parameters.uc    
                prompt[latentImageNodeId].inputs.width = parameters.width
                prompt[latentImageNodeId].inputs.height = parameters.height
                prompt[latentImageNodeId].inputs.batch_size = parameters.n_samples
                break
              }
            }
            for (const nodeId in prompt) {
              if (prompt[nodeId].class_type === 'CheckpointLoaderSimple') {
                prompt[nodeId].inputs.ckpt_name = options.model ?? config.model
                break
              }
            }
            logger.debug('prompt:', prompt)
            return  { prompt }
          }
        }
      }

      const getHeaders = () => {
        switch (config.type) {
          case 'login':
          case 'token':
          case 'naifu':
            return { Authorization: `Bearer ${token}` }
          case 'stable-horde':
            return { apikey: token }
        }
      }

      let finalPrompt = prompt
      const iterate = async () => {
        const request = async () => {
          const res = await ctx.http(trimSlash(config.endpoint) + path, {
            method: 'POST',
            timeout: config.requestTimeout,
            // Since novelai's latest interface returns an application/x-zip-compressed, a responseType must be passed in
            responseType: config.type === 'naifu' ? 'text' : ['login', 'token'].includes(config.type) ? 'arraybuffer' : 'json',
            headers: {