INNER CODE UNIT · TypeScript

askStream

xiangsx/gpt4free-ts · model/ails/index.ts:97

  public async askStream(req: ChatRequest, stream: EventStream) {
    const now = moment().valueOf();
    const data = {
      model: 'gpt-3.5-turbo',
      temperature: 1,
      stream: true,
      messages: req.messages,
      d: moment().format('YYYY-MM-DD'),
      t: `${now}`,
      s: Utils.hash({
        t: now,
        m: contentToString(req.messages[req.messages.length - 1].content),
      }),
    };
    try {
      const res = await this.client.post('/v1/chat/completions', data, {
        responseType: 'stream',
      } as AxiosRequestConfig);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…