Spaces:
Running
Running
from flask import Flask, request, jsonify | |
import bingChat | |
import api_info | |
app = Flask(__name__) | |
def initial(): | |
return '<pre>' + api_info.default_info + '</pre>' | |
def available_models(): | |
return jsonify(api_info.available_models) | |
def endpoints(): | |
return jsonify(api_info.endpoint) | |
def developer_info(): | |
return jsonify(api_info.developer_info) | |
def generate(): | |
conversation_history = request.args.get('conversation_history') # Assuming the query is sent in JSON format | |
realtime = request.args.get('realtime', False) | |
md_format=request.args.get('md_format', True) | |
if conversation_history: | |
response = bingChat.ddc_bing_converse(conv_history=conversation_history) | |
return jsonify([{'response': response}]), 200 | |
else: | |
return jsonify(api_info.error_message), 400 | |
if __name__ == '__main__': | |
app.run(debug=True) | |