mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00

* perf: transcriptions api * perf: variable picker tip * perf: variable picker tip * perf: chat select app * feat: router to app detail * perf: variable avoid space * perf: variable picker * perf: doc2x icon and params * perf: sandbox support countToken * feat: sandbox support delay and countToken
31 lines
679 B
TypeScript
31 lines
679 B
TypeScript
import fs from 'fs';
|
|
import { getAxiosConfig } from '../config';
|
|
import axios from 'axios';
|
|
import FormData from 'form-data';
|
|
|
|
export const aiTranscriptions = async ({
|
|
model,
|
|
fileStream
|
|
}: {
|
|
model: string;
|
|
fileStream: fs.ReadStream;
|
|
}) => {
|
|
const data = new FormData();
|
|
data.append('model', model);
|
|
data.append('file', fileStream);
|
|
|
|
const aiAxiosConfig = getAxiosConfig();
|
|
const { data: result } = await axios<{ text: string }>({
|
|
method: 'post',
|
|
baseURL: aiAxiosConfig.baseUrl,
|
|
url: '/audio/transcriptions',
|
|
headers: {
|
|
Authorization: aiAxiosConfig.authorization,
|
|
...data.getHeaders()
|
|
},
|
|
data: data
|
|
});
|
|
|
|
return result;
|
|
};
|