Skip to content
Open

Testing #1120

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c864fb2
```
Natwar589 Nov 28, 2025
a629511
feat: Add `variables` to the AI call request body.
husainhackerrank-afk Dec 2, 2025
8731c98
refactor: Reorder `variables` assignment in request body to occur aft…
husainhackerrank-afk Dec 2, 2025
180fddf
Merge pull request #1093 from Walkover-Web-Solution/remove_rudant_code
harshhsahu Dec 2, 2025
2d7d6b1
feat: Implement setup_agent_pre_tools function to configure agent-spe…
Husainbw786 Dec 3, 2025
b45f17a
Merge pull request #1097 from Walkover-Web-Solution/pre_tool_bug_test
harshhsahu Dec 3, 2025
e9e81e1
Merge branch 'master' of github.com:Walkover-Web-Solution/AI-middlewa…
Dec 3, 2025
ebfddb7
refactor: remove numerous controllers, routes, and services, and upda…
Natwar589 Dec 4, 2025
56446d5
Remove general prebuilt prompt retrieval and bridge integration, and …
Natwar589 Dec 4, 2025
c56774c
Merge pull request #1099 from Walkover-Web-Solution/remove_migrated_code
harshhsahu Dec 4, 2025
7f9a849
remove unused file (#1100)
harshhsahu Dec 4, 2025
b2fe1bf
refactor: Extract API key normalization logic into reusable `_normali…
ViaSocket-Git Dec 4, 2025
f8b7cd3
refactor: remove unused OrchestratorHistoryService and clean up impor…
husainhackerrank-afk Dec 4, 2025
e39076c
Merge pull request #1101 from Walkover-Web-Solution/bug_embedUser_has…
harshhsahu Dec 4, 2025
74a2b40
fix: update JWT token decoding to use a hardcoded secret key
Husainbw786 Dec 11, 2025
66c7b33
fix: update JWT token decoding to use configurable secret key from Co…
husainhackerrank-afk Dec 12, 2025
d50e460
feat: add support for OPENAI_API_KEY_GPT_5_NANO in configuration and …
husainhackerrank-afk Dec 15, 2025
9de296e
feat: enhance agent variable handling by introducing variables_path m…
husainhackerrank-afk Dec 17, 2025
d88155a
fix: improve handling of apikey_object_id to ensure safe access to se…
husainhackerrank-afk Dec 18, 2025
d890008
fix: ensure safe access to connected agent details by providing a def…
husainhackerrank-afk Dec 18, 2025
9389289
feat: enhance batch processing by adding support for batch_variables …
husainhackerrank-afk Dec 18, 2025
9dbcd75
fix: improve error handling in batch response processing by checking …
husainhackerrank-afk Dec 18, 2025
f8bd42a
fix: enhance batch processing by adding validation for user, images, …
husainhackerrank-afk Dec 18, 2025
1acc447
refactor: rename 'openai_batch_' to 'batch_' in configuration and upd…
husainhackerrank-afk Dec 18, 2025
26e5c51
fix: ensure safe access to endpoint_name and function_name in tool ch…
husainhackerrank-afk Dec 18, 2025
7017631
Merge branch 'master' of github.com:Walkover-Web-Solution/AI-middlewa…
Dec 19, 2025
b54016c
refactor: remove sensitive data from conversation data before sending…
Husainbw786 Dec 24, 2025
ed7c995
fix image issue
Dec 24, 2025
8339c8a
refactor: streamline sensitive data handling in conversation history …
husainhackerrank-afk Dec 25, 2025
e638c9f
Merge pull request #1123 from Walkover-Web-Solution/fix_api_key_in_db…
harshhsahu Dec 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ PROJECT_ID=
RTLAYER_AUTH=
max_workers=150
REDIS_URI=redis://localhost:6379
MUI_TEMPLATE_ID=
CHATBOT_OPTIONS_TEMPLATE_ID=
MUI_TEMPLATE_ID_WITHOUT_ACTION=
ENVIROMENT=LOCAL
QUEUE_CONNECTIONURL=
CONSUMER_STATUS=TRUE
Expand Down
6 changes: 2 additions & 4 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Config:
DB_PASS = os.getenv('DB_PASS')
DB_HOST = os.getenv('DB_HOST')

chatBotFLow = os.getenv('chatBotFLow')
TIMESCALE_SERVICE_URL = os.getenv('TIMESCALE_SERVICE_URL')
OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')
SecretKey = os.getenv('SecretKey')
Expand All @@ -33,8 +32,6 @@ class Config:
CHATBOTSECRETKEY = os.getenv('CHATBOTSECRETKEY')
TEMPLATE_ID = os.getenv('TEMPLATE_ID')
max_workers = os.getenv('max_workers')
MUI_TEMPLATE_ID = os.getenv('MUI_TEMPLATE_ID')
MUI_TEMPLATE_ID_WITHOUT_ACTION = os.getenv('MUI_TEMPLATE_ID_WITHOUT_ACTION')
CHATBOT_OPTIONS_TEMPLATE_ID = os.getenv('CHATBOT_OPTIONS_TEMPLATE_ID')
QUEUE_CONNECTIONURL = os.getenv('QUEUE_CONNECTIONURL')
QUEUE_NAME = os.getenv('QUEUE_NAME')
Expand All @@ -58,4 +55,5 @@ class Config:
DOCSTAR_ORG_ID = os.getenv('DOCSTAR_ORG_ID')
DOCSTAR_COLLECTION_ID = os.getenv('DOCSTAR_COLLECTION_ID')
AI_ML_APIKEY = os.getenv('AI_ML_APIKEY')
AI_MIDDLEWARE_PAUTH_KEY = os.getenv('AI_MIDDLEWARE_PAUTH_KEY')
AI_MIDDLEWARE_PAUTH_KEY = os.getenv('AI_MIDDLEWARE_PAUTH_KEY')
OPENAI_API_KEY_GPT_5_NANO = os.getenv('OPENAI_API_KEY_GPT_5_NANO')
57 changes: 2 additions & 55 deletions index.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
import src.routes.rag_routes
from fastapi import FastAPI
from fastapi.responses import JSONResponse, StreamingResponse
from fastapi.exceptions import RequestValidationError
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
import asyncio
from contextlib import asynccontextmanager
import src.services.utils.batch_script
from src.services.utils.batch_script import repeat_function
from config import Config
from src.controllers.modelController import router as model_router
from src.routes.chatBot_routes import router as chatbot_router
from src.routes.apiCall_routes import router as apiCall_router
from src.routes.config_routes import router as config_router
from src.controllers.bridgeController import router as bridge_router
from src.routes.v2.modelRouter import router as v2_router
from src.services.commonServices.queueService.queueService import queue_obj
from src.services.commonServices.queueService.queueLogService import sub_queue_obj
from src.services.utils.logger import logger
from src.routes.bridge_version_routes import router as bridge_version
from src.routes.image_process_routes import router as image_process_routes
from src.routes.utils_router import router as utils_router
from src.routes.rag_routes import router as rag_routes
from src.routes.Internal_routes import router as Internal_routes
from src.routes.testcase_routes import router as testcase_routes
from src.routes.image_process_routes import router as image_process_routes
from models.Timescale.connections import init_async_dbservice
from src.routes.runagents_routes import router as runagents_routes
from src.routes.orchestrator_routes import router as orchestrator_routes
from src.routes.prebuilt_prompt_route import router as prebuilt_prompt_router
from src.configs.model_configuration import init_model_configuration, background_listen_for_changes
from globals import *

Expand Down Expand Up @@ -135,27 +124,6 @@ async def healthcheck():
return JSONResponse(status_code=200, content={
"status": "OK running good... v1.2",
})


@app.get("/90-sec")
async def bloking():
try:
async def blocking_io_function():
await asyncio.sleep(90) # Sleep for 2 minutes
# response = await fetch("https://flow.sokt.io/func/scriDLT6j3lB")
# return response
result = await blocking_io_function()
return JSONResponse(status_code=200, content={
"status": "OK running good... v1.1",
"api_result": result
})
except Exception as e:
return JSONResponse(status_code=500, content={
"status": "Error",
"error": str(e)
})



@app.exception_handler(RequestValidationError)
async def validation_exception_handler(exc: RequestValidationError):
Expand All @@ -164,33 +132,12 @@ async def validation_exception_handler(exc: RequestValidationError):
content={"detail": "Custom error message", "errors": exc.errors()},
)

# New route for streaming data
@app.get("/stream")
async def stream_data():
async def generate():
for i in range(100):
yield f"data: {i}\n\n\n"
await asyncio.sleep(1)

return StreamingResponse(generate(), media_type="text/event-stream")

# Include routers
app.include_router(model_router, prefix="/api/v1/model")
app.include_router(v2_router, prefix="/api/v2/model")
app.include_router(chatbot_router, prefix="/chatbot")
app.include_router(bridge_router, prefix="/bridge")
app.include_router(config_router, prefix="/api/v1/config")
app.include_router(apiCall_router, prefix="/functions")
app.include_router(bridge_version, prefix="/bridge/versions" )
app.include_router(image_process_routes, prefix="/image/processing" )
app.include_router(image_process_routes, prefix="/files" )
app.include_router(utils_router, prefix="/utils" )
app.include_router(rag_routes,prefix="/rag")
app.include_router(Internal_routes,prefix="/internal")
app.include_router(testcase_routes, prefix='/testcases')
app.include_router(runagents_routes, prefix='/publicAgent')
app.include_router(orchestrator_routes, prefix='/orchestrator')
app.include_router(prebuilt_prompt_router, prefix='/prebuilt_prompt')


if __name__ == "__main__":
Expand Down
7 changes: 0 additions & 7 deletions models/Timescale/connections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
import sqlalchemy.ext.asyncio as sa_async
from sqlalchemy import text
from sqlalchemy.ext.declarative import declarative_base
Expand All @@ -23,12 +22,6 @@ async def init_async_dbservice():
except Exception as error:
logger.error(f'Unable to connect to the database: {str(error)} {traceback.format_exc()}')

# Example async function to fetch data
async def fetch_data(query):
async with AsyncSession() as session:
result = await session.execute(query)
return result.fetchall()

# Initialize database connection
db = {
'engine': async_engine,
Expand Down
5 changes: 2 additions & 3 deletions models/postgres/pg_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ def load_models():

db['engine'] = engine
db['session'] = Session
# db['conversations'] = sa.Table('conversations', sa.MetaData().reflect(bind=engine), autoload_with=engine)

metadata = sa.MetaData()

# Reflect the table from the database
metadata.reflect(bind=engine)
# db['conversations'] = metadata.tables['conversations']
# db['raw_data'] = metadata.tables['raw_data']



# This dictionary is now ready to be used.
76 changes: 0 additions & 76 deletions models/postgres/pg_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,6 @@
import uuid
from models.postgres.pg_connection import Base

class Conversation(Base):
__tablename__ = 'conversations'
__table_args__ = {'extend_existing': True}

id = Column(Integer, primary_key=True)
org_id = Column(String)
thread_id = Column(String)
model_name = Column(String)
bridge_id = Column(String)
message = Column(Text)
message_by = Column(String)
function = Column(JSON)
type = Column(Enum('chat', 'completion', 'embedding', name='enum_conversations_type'), nullable=False)
createdAt = Column(DateTime, default=func.now())
updatedAt = Column(DateTime, default=func.now(), onupdate=func.now())
chatbot_message = Column(Text)
is_reset = Column(Boolean, default=False)
tools_call_data = Column(ARRAY(JSON))
user_feedback = Column(Integer)
message_id = Column(UUID(as_uuid=True), nullable=True)
version_id = Column(String)
sub_thread_id = Column(String, nullable=True)
revised_prompt = Column(Text, nullable=True)
image_urls = Column(ARRAY(JSON), nullable=True)
urls = Column(ARRAY(String), nullable=True)
AiConfig = Column(JSON, nullable=True)
annotations = Column(ARRAY(JSON), nullable=True)
fallback_model = Column(String, nullable=True)

class RawData(Base):
__tablename__ = 'raw_data'
__table_args__ = {'extend_existing': True}


id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, nullable=False)
org_id = Column(String)
authkey_name = Column(String)
latency = Column(Float)
service = Column(String)
status = Column(Boolean, nullable=False)
error = Column(Text, default='none')
model = Column(String)
input_tokens = Column(Float)
output_tokens = Column(Float)
expected_cost = Column(Float)
created_at = Column(DateTime, default=func.now())
chat_id = Column(Integer, ForeignKey('conversations.id'))
message_id = Column(UUID(as_uuid=True), nullable=True)
variables = Column(JSON)
is_present = Column(Boolean, default=False)
firstAttemptError = Column(Text, nullable=True)
# conversation = relationship("Conversation", back_populates="raw_data")
finish_reason = Column(String, nullable=True)

class system_prompt_versionings(Base):
__tablename__ = 'system_prompt_versionings'
__table_args__ = {'extend_existing': True}
Expand All @@ -82,28 +28,6 @@ class user_bridge_config_history(Base):
time = Column(DateTime, nullable=False, default=func.now())
version_id = Column(String, nullable=True, default="")

class OrchestratorHistory(Base):
__tablename__ = 'orchestrator_history'
__table_args__ = {'extend_existing': True}

id = Column(Integer, primary_key=True, autoincrement=True)
org_id = Column(String, nullable=False)
thread_id = Column(String, nullable=False)
sub_thread_id = Column(String, nullable=False)
model_name = Column(JSON, nullable=False) # {"bridge_id": "model_name"}
orchestrator_id = Column(String, nullable=False)
user = Column(JSON, nullable=False) # {"bridge_id": [user_messages]}
response = Column(JSON, nullable=True) # {"bridge_id": response_json}
tool_call_data = Column(JSON, nullable=True) # {"bridge_id": tool_call_json}
createdAt = Column(DateTime, nullable=False, default=func.now())
latency = Column(JSON, nullable=True) # {"bridge_id": latency_json}
tokens = Column(JSON, nullable=True) # {"bridge_id": tokens_json}
error = Column(JSON, nullable=True) # {"bridge_id": error_json}
variables = Column(JSON, nullable=True) # {"bridge_id": variables_json}
user_urls = Column(JSON, nullable=True) # {"bridge_id": [user_urls]}
llm_urls = Column(JSON, nullable=True) # {"bridge_id": [llm_urls]}
ai_config = Column(JSON, nullable=True) # {"bridge_id": ai_config_json}

class OrchestratorConversationLog(Base):
__tablename__ = 'orchestrator_conversation_logs'
__table_args__ = {'extend_existing': True}
Expand Down
36 changes: 0 additions & 36 deletions prompts/mui_prompt.py

This file was deleted.

Loading