This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openai import AsyncOpenAI | |
client = AsyncOpenAI( | |
api_key=get_settings().OPENAI_API_KEY, | |
) | |
# ---------------------------------------------------------------------------------------------- | |
async def get_response_openai(aichat: AiChatDB): | |
if aichat.model=="gpt-3.5-turbo" or aichat.model=="gpt-4": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// an after-the-DOM is loaded wrapper, | |
// this makes designated elements slide up and disappear as soon as the page is visible, | |
// as well as holds conditional slide up/down logic for correctly configured content (see comments below): | |
$(function() { | |
// elements with a class of "content-hideable" have a "rel" attribute equal to the class of content | |
// that should be 'hidden' or 'revealed' upon a mouse click, accomplished via an animated toggle: | |
// for each element with class "content-hideable": | |
$('.content-hideable').each( function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inside the file libavformat/utils.c is the routine "int av_read_frame(AVFormatContext *s, AVPacket *pkt)", one of the key routines | |
// used to play video streams through FFMPEG's libav. This routine does not handle the situation when a live stream terminates | |
// unexpectedly, such as the unplugging of a network connection, power loss to a camera, or other reasons an established connection | |
// would unexpectedly stop delivering packets. | |
// Below is the beginning of av_read_frame() up to and a bit past the three added lines necessary to support calling of the installed | |
// avformat interrupt callback. The conventional libav behavior is to call the avformat interrupt callback while establishing a new | |
// connection with a live stream. It is not called while the stream is playing, therefore no opportunity is provided to the client | |
// software to recognise unexpected stream termination. | |
// The three lines are added to the code pasted below. They should be easy to identify: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This file contains two code fragments: | |
// 1) A C++ class, an implementation of a general use AVFilterGraph for video playback. This class demonstrates a "best guess" of | |
// how an AVFilterGraph should be constructed, yet some WMV and AVI sourced video frames do not convert from the codec native format | |
// (yuv420p?) to the requested RGBA. | |
// | |
// 2) A C++ code fragment demonstrating how the above CE_LIBAV_FrameFilter class is used, and the error correcting logic catching | |
// when YUV to RGB conversion is incorrect, and a work-around for the pixel format conversion bug | |
// | |
// It appears a barebones AVFilterGraph is required to receive stable playback when working with a wide variety of formats & devices. |